I was putting together an upload form today that uploads to a file to PHP. On submit, the $_FILES var was empty and for the life of me I couldn't figure out what was going on.
- I tried a print_r on both $_POST and $FILES. Both showed up empty.
- Added info to the $_GET to make sure the POST was even going to the action page.
- Made sure I had enctype="multipart/form-data" in the form.
Apparently for these forms to work, the input type="file" also needs the name attribute. Once I added name="file" the $_FILES var showed with upload data, just as it should. Anyway, I hope this saves someone some time.