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
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.
The file is uploaded first using ajax. Just separate it from the handler