php - Regarding the problem that file uploads are always overwritten after modifying the form
PHP中文网
PHP中文网 2017-05-16 13:11:07
0
3
825

After uploading files through the form, I encountered this problem:

When submitting for the first time, any field can be fully saved.

But when I modify the form for the second time, the field of <input type="file"> is always automatically empty. How can I make the file type form have a value by default like the text type? After modification, Submission will not change

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
伊谢尔伦

The characteristic of the file control is that the user needs to manually select the file before the value will be available. It is recommended to give the file field a default value on the server side, or use js to determine whether the value of the file control is empty before submitting the front-end form. If it is empty, then Do not submit, prompt the user instead.

漂亮男人

You can make a judgment in php, that is, when the file field is empty when modifying the form for the second time, you can make a judgment in php. If the file is empty, when updating the database data, the file field will not be updated. If If the submitted file is not empty, the file field is updated.

PHPzhong

The file is uploaded first using ajax. Just separate it from the handler

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template