I am looking for a solution where I want to retain the uploaded files even after a submit button is clicked. In my case I am planning to give a choice for the user that when the user feels that one of the uploaded file is not of his choice even after post submit, he can reupload only that file which he wants to replace and not requiring to reupload the other files. Is there a way how this can be done using HTML, PHP.
Thanks
Once the file has been uploaded use
move_uploaded_fileto move it to a temporary location (don’t just leave it in the systems tmp directory in case it get’s automatically cleaned up).When the form has been submitted you can then move it from the temporary location to a permanent one using
rename.Then write a script that runs every X hours that goes through files in your temporary location that are older than a certain time period (
filemtime) and delete them (unlink) to clean up any files that were uploaded but the form was not submitted.