I use Kartik file input in the yii2 framework I want to implement a batch upload of photos with the ability to remove some photos BEFORE they are loaded, here's the code

<?= $form->field($model, 'imageFiles[]')->widget(FileInput::classname(), [ 'options' => ['accept' => 'image/*','multiple' => true], 'pluginOptions' => [ 'uploadUrl' => Url::to(['/site/upload']), 'uploadExtraData' => [ 'album_id' => 20, 'cat_id' => 'Nature' ], 'maxFileCount' => 10 ] ])->label('') ?> 

I understand that you need to save pictures in the Site controller in the upload method, but I don’t understand how to catch them there via POST only this comes

 'album_id' => 20, 'cat_id' => 'Nature' 

Can someone help?

1 answer 1

Directly from the manual about your example:

 use yii\web\UploadedFile; .... $model->imageFiles = UploadedFile::getInstances($model, 'imageFiles')