I’ve been trying to get the scripts from here working, without much luck. So I tried downloading the script from the page but I get the same results. It’s not uploading files although the progress bar shows them as uploaded. Nothing is shown in Status Messages and there are no console errors.
If I use dev tools to change the display style of the submit button back to block and click it, it uploads one file, but that’s not how it’s supposed to work I’m thinking…
Hm that’s very strange… I just tested it on chromium with PHP’s built-in dev server (just from the project root) and it worked fine for me. Does the upload.php request show up in the network panel of the browser dev tools?
Another thing I would check is the upload_max_filesize and post_max_size in your php.ini file isn’t a small value. I’ve gone through hundreds of projects of mine struggling to figure out why things aren’t uploading and then finally find out I forget to increase those.
Done that, too. I got caught out with another script, nothing uploading and eventually found it was a large file, so I’ve been testing it with the smallest images I could find.
Mebbe I should try it online, but that probably won’t be till the weekend now…
Ah…! That suggests that $_SERVER['HTTP_X_FILENAME'] isn’t set, so the PHP script runs into the else block. This also explains why it works with the regular submit button, where $_FILES['fileselect'] is set instead. I found this thread on SO (which happens to refer to the same SP article), where the solution is to use hyphens instead of underscores for the header key.
PS: Indeed, underscores seem to be forbidden for header keys on both apache and nginx servers… I wasn’t aware of that either, so good to know. :-)