For my PHP 7.0.27 this is incompatible to the "multiple" tag on inputs.
Like this:
<input type="file" name="files[]" multiple>
Please note that you need to use 'files[]', as else only one file is used from the uploaded files.
As documented, you need to give the Index into $_FILES as the first argument to this function. Like in:
foreach ($_FILES as $k=>$v)
$db->getGridFS()->storeUpload($k, $v);
However in the case of "multiple" selects, the corresponding entry in $_FILES[$k]["name"] is an array of filenames, not just a single filename. This is true even for a single file, in that case it is an array with just a single string in it.
In that case the function just silently fails. No error, no problem shown, it just becomes a NOP.
The workaround is:
- Without JavaScript, fallback to single file upload.
- With JavaScript add "multiple", and do the upload with Ajax file-by-file.
- As then only single files reach PHP, the problem is solved.