how to update type=file

2019-09-20 15:48发布

问题:

how to update type=file

These lines are in my update file. This one works. It echos the $row and i can change it or let it be.

<textarea  cols="25" rows="5" name="bio" ><?php echo $row['bio']?> </textarea> </tr></td>

Now my question is, how can i get the same thing work with an type="file" ?

<input type="file" name="img" accept="image/jpg,image/gif,image/png" /></tr></td>

回答1:

You cannot do that due to browser security reasons.

But there's something else you can do.

Display the uploaded pic below the file upload field.If the user wants to change it , let him upload another pic or else just leave it blank.

In the server-side just check if the field is blank or not and do the necessary action.



回答2:

You cannot pre-fill the value of the file upload control (as a security precaution)



标签: php file input