Answer the question
In order to leave comments, you need to log in
How to upload multiple files in yii?
Hello! See here how to upload files.
In the case of one file, I did this and everything worked:
if ($model->load(Yii::$app->request->post())) {
$model->Scan_chek = UploadedFile::getInstance($model, 'Scan_chek');
if ($model->save()) ...
if ($model->load(Yii::$app->request->post())) {
$model->Scan_chek = UploadedFile::getInstances($model, 'Scan_chek');
if ($model->upload())
if ($model->save())
public function upload()
{
if ($this->validate()) {
foreach ($this->Scan_chek as $file) {
$file->saveAs('uploads/' . $file->baseName . '.' . $file->extension); <- указывает сюда
}
return true;
} else {
return false;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question