File Upload Multi Page Form

I am trying to make a multi page form which has a file upload on the 1st page. I have tried sessions but they do not seem to work with file uploads. I hope someone can point me in the right direction.

Thanks in advance,

Scott

This isn’t very pretty, but it will work. Just pass all your form elements and populate hidden elements on your next page’s form. You final form will have all the data you require.

I originally tried that method, but the file upload did not pass. Here is what I need to accomplish: (Short Version)

form1:upload file & text input
form2:text input
form3: insert form1 & 2 into same row in database

I have used sessions and the text input works no problem. I can get the file to upload / download if the form action is the next page. When I try and put a page in between it does not work. Unfortunately the client wants the upload on form1.

Not sure how to accomplish this…

Thank you,

Scott

When you do your file upload, you can copy the file to a temporary location. Pass that value in either a session or hidden attribute and then continue on to page 2 and 3 where you can do your final disposition on the file.

I failed to mention… The file is uploading to mysql

Any chance I can get a code snippet or a link with a sample?

Thanks!

Scott

Not only is it not pretty, it’s also a security hole the size of the Titanic :wink:

If you want form1 to have the upload page, then you should process the file upload on page2. That’s about as simple as it gets and as simple as I can make it. Store it in some semi-temporary directory on your host (preferably outside the server software’s scope), and continue with the rest of the pages. Then on the last page, process the rest of the data, and apply whatever you need to, to the previously uploaded file.

PHP says: if you don’t process the file -right away-, I’ll get rid of it, no questions asked.

Sponsor our Newsletter | Privacy Policy | Terms of Service