Do you have an elegant solution to validate server side a form containing more than one input type file under these conditions:
- If one the file is not valid user will have to upload another
- If one file if valid the server should keep it in memory so user don't have to upload it again.
- User may just abort and leave the page. Whatever has been saved on the server should be deleted.
As I example let's take a form containing 1 input type text and 2 inputs type file.
<input type="text" name="title" />
<input type="file" name="file1" />
<input type="file" name="file2" />
User submit a valid title, a valid file1 but invalid file2.
The goal here is to save each valid file until the form is valid or until session expires or something expires :)
Suggestion 1
Generate a unique key for the user form (i.e form123) create a directory /tmp/uploads/form123 where valid file are saved.
A cron running every 10min go through all directories in /tmp/uploads/ and delete the one existing for more than 10min.
Aucun commentaire:
Enregistrer un commentaire