I have a multipage form with a validation group for every page. I send the complete form from page to page. The form fields from other pages are hidden. I can navigate forth and back between pages. One Page have a file upload. What's the best solution to handle it? I don't want to send the file from page to page. Can save it and bind it to request?
Asked
Active
Viewed 75 times
0
-
My suggestion would be to upload and save the file somewhere in a temporary directory, and save the name of the file into the session, or transfer it too between the pages. Then if the user gets validated after the final page, you can move it to a more conventional directory, and save it's name in the DB. Also, don't forget to clean the temp directory from time to time, to get rid of unfinished registrations (or whatever you are doing with the forms.) – zeykzso Mar 31 '14 at 12:50
-
Also, be aware that you cannot navigate a file between pages, browsers doesn't let you put a file source from the server, it would be a huge security risk for the client. – zeykzso Mar 31 '14 at 12:57
-
hombee recommendation is the way to go. You have to save the files temporarily somewhere and refer to them in later stages of the form. Also check this bundle, which providers nice handling of file uploads and also a method to take care of orphaned files: https://github.com/1up-lab/OneupUploaderBundle – Alberto Fernández Mar 31 '14 at 16:28