Description
I believe there is a problem with bootstrap file input when using attribute "multiple".
In order to correctly upload multiple files i have to define my file input as array. For example:
<?= $this->Form->input( 'images[]', [ 'multiple' => true, 'type' => 'file'] ); ?>
This creates the file upload widget that includes a fake input for displaying number of files chosen:
<input type="text" name="images[]-text" class="form-control" readonly="readonly" id="images-input" onclick="document.getElementById('images').click();" value="">
Here is where the problem is:
When I dump the contents of $_FILES
super global variable all the chosen files are there as expected. However, if I dump $this->request->data
one of the files is missing because the fake text input overrides it. What I propose is to replace readonly
attribute on the fake input with a disabled
so that it doesn't get submitted (which proved to fix the issue for me).