Reputation: 1316
i have using swiftmailer. I have also included in all my layout files. i am facing a problem
Bad Request (#400) Unable to verify your data submission.
it work's fine with single file but when i select multiple file it shows the error message
Bad Request (#400)
Unable to verify your data submission.
please help me to solve the problem
Upvotes: 1
Views: 904
Reputation: 1092
Try using this
echo $form->field($model, 'fileUpload[$custModel->document_id][]')->widget(FileInput::classname(), [
'options'=>['accept'=>'image/*', 'multiple'=>true],
'pluginOptions'=>['allowedFileExtensions'=>['jpg','gif','png']
])->label(Yii::$app->params['required_docs'][$custModel->document_id]);
your rule should look like this
[['fileUpload'], 'safe'],
[['fileUpload'], 'file', 'extensions'=>'jpg, gif, png','maxFiles' => 5],
and in your controller action, make sure that you are using
$images = UploadedFile::getInstances($model, 'fileUpload'); // not getInstance
Upvotes: 1