Changes
Title
unchanged
How to read HTML5 Multiple File Input from controller?
Category
unchanged
How-tos
Yii version
changed
2.0
Tags
changed
yii, Yii,widget,input,multiple,HTML5,yii2, file, input, fileinput, widget, upload, html5, multipleupload
Content
changed
[...]
Solution
--------
You must configure the attribute name for HTML5 file input in ARRAY FORMAT for PHP to recognize it as an array of files. So here is how you achieve this as shown below (note the square brackets in the attribute naming):
### For Yii 21.1
```php
echo $form->fi
eldleInput($model, 'uploadFile[]'
)->fileInput(, ['multiple' => true]);
```
### For Yii
1.12
```php
echo $form->fi
leInputeld($model, 'uploadFile[]'
, )->fileInput(['multiple' => true]);
```
### For \kartik\widgets\FileInput (Yii 2)
```php
echo $form->field($model, 'uploadFile[]')->widget(FileInput::classname(), [
'options'=>['multiple' => true]
]);
```