Answer the question
In order to leave comments, you need to log in
How to make such a multiload in yii2?
Hello.
I have a post update form that generates inputs like this
<input name="Model[imageFiles][25]" type="file">
<input name="Model[imageFiles][36]" type="file">
<input name="Model[imageFiles][89]" type="file">
UploadedFile::getInstances($model, 'imageFiles')
array(2) {
[0]=>
object(yii\web\UploadedFile)#223 (5) {
["name"]=>
string(6) "bg.jpg"
["tempName"]=>
string(39) "\phpC709.tmp"
["type"]=>
string(10) "image/jpeg"
["size"]=>
int(285557)
["error"]=>
int(0)
}
[1]=>
object(yii\web\UploadedFile)#224 (5) {
["name"]=>
string(8) "matr.jpg"
["tempName"]=>
string(39) "\phpC71A.tmp"
["type"]=>
string(10) "image/jpeg"
["size"]=>
int(10130)
["error"]=>
int(0)
}
}
Answer the question
In order to leave comments, you need to log in
1. Remove from the input(type="file") id images.
2. Add inputs(type="hidden") with id of images in the same sequence as input(type="file")
3. Perform comparison on the server
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question