Unable to upload multiple files

I want to upload multiple files but I am unable to do so. maxFiles for upload is 3 but only 1 file is getting uploaded. Below is the MVC code for the same

My View -

<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>

<?= $form->field($modelItem, 'imageFiles')->fileInput(['multiple' => true,'accept' => 'image/*']); ?>

<?php ActiveForm::end() ?>

My Model -

[['imageFiles'], 'file', 'extensions' => 'png, jpg', 'maxFiles' => 3],

[['imageFiles'], 'required']

My Controller -

$itemModel->imageFiles = UploadedFile::getInstances($itemModel, 'imageFiles');

foreach ($itemModel->imageFiles as $file) 


$path = 'uploads/itemPictures/' . $file->baseName . '.' . $file->extension;



Even if I am selecting 3 files for upload only one file is getting uploaded. Please help.

Can you attach your dev-log? Any error appears after the action? Give more information on the problem.

Not getting any error after action…not sure where it is failing.



Thanks it worked