The following two questions clarify that the value of input file
cannot be changed due to security reasons.
In PHP, when validating a form, one of the usual approaches is to re-fill the entered value in input text
that was provided before clicking the submit
button, so that the client knows what he inserted, or simply to keep the values in the fields, which is what the client is expecting. (He won't have to re-fill the form every time when there's a specific error).
So we use the following:
<input type="text" name="title" id="title" maxlength="100" value="<?php echo htmlspecialchars($title);?>" />
So since I cannot change the value of the input file
, so I can re-fill it with the provided path $image['tmp_name']
, this means the client will have to re-upload (or re-browse) the image each time a validation goes wrong, isn't there any possible way to keep that value?