I am somewhat a newbie to PHP. I am trying to create a file upload. It seems to upload to the tmp directory, but fails to move when using move_upload_file(). When checking the $_FILES array after uploading, it shows that everything should be good, including 0 errors. Not sure what I'm doing wrong. HELP!
I am also a noobie and have seen many excellent tutorial like the one linked to above, and it all makes sense except ...
How would one do this if:
1. The form was on one page.
2. That form contained 2 or more “files” inputs.
3. The upload would be done on another page?
For example, the user enters data on one form, checks it on a second, and then the 3rd form handles the upload. How would I pass the $_FILES info along and how do I tell the upload routine to upload each file in turn?
After spending the weekend plus on this, again, self-teaching from the Internet, I figured out this would not be possible. I had been learning the syntax and all before the working concepts, and the many, many examples I read that told me how to upload files never mentioned how it all actually works.
When you submit and enctype is set properly the file is uploaded to a temporary folder on the server. The php code on the next page (action) looks at the information provided by $_FILES, decides whether or not to accept it, and if it does it simply moves the temp file to the destination folder.
Maybe that will help someone like myself.
I'm still wondering is during a submit I can upload more than one file then handle that in the 'action' page's php script. When I get time I'll try a few things.