When I have 2 different forms on the page, the $_FILES variable is empty when someone clicks the “Upload” button. If have only the file upload form on the page, the $_FILES variable works as expected and contains all of the necessary information. I verified this by doing a var_dump($_FILES) using my php controller file.
I have checked the php.ini file to make sure that uploads are working, and I as noted, if I remove all forms except the one for file uploads, then everything works as expected.
Any suggestions on how to manage this? I could create a separate page, but I would rather allow uploads directly from this one page.
I would say as your example only has the one form which is working so it is not a lot of help locating the problem.
I would have an example of what is not working.
Thanks Rubble. All items have different names. I can’t use a single submit button because there are several different items on a single page. I simplified the problem here for illustration and so I don’t have to post all of my code. I will keep looking for a solution.
The $_POST variable shows the value of “Upload” along with the name of the file selected for upload. So the form is submitting the correct data to $_POST, but the $_FILES variable is getting cleared. I need to look at my controller script and see if I made a mistake in the processing that unintentially clears $_FILES. (BTW, how do I get the underscore to stay? It keeps converting my text to italics)
I found the error … it was bad html … I had <form> tag that didn’t have its </form> closing tag. That ran into my new form … now it is working! Thank you for the help!