Restoring the value of a input type=file after failed validation

You cannot populate the file input, to do so would be a serious security problem.

Instead, store the uploaded content on the server and store an id that you can use to reference it in a hidden input.

Clean the files up automatically after they reach a certain age, and provide a means for the user to change their mind about what file they want to upload (e.g. a checkbox (checked by default) for each file being stored on the server for upload)

Leave a Comment