You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a page with several models, arranged as array, and they have a file_input control.
But the attribute never gets the UploadedFile object because of differences in the name of the files in the $_FILES array.
I got around this problem by using a third check in BeforeValidade event. Maybe you guys want to use this solution in yii2-upload-behavior.
if (empty($this->file)) {
$this->file = UploadedFile::getInstanceByName($this->attribute);
if (empty($this->file))
{
$id=$this->owner->id;
$att=$this->attribute;
$name= $this->owner->formName()."[$id][$att]";
$this->file = UploadedFile::getInstanceByName($name);
}
}
if ($this->file instanceof UploadedFile) {
$this->owner->{$this->attribute} = $this->file;
}
}
The text was updated successfully, but these errors were encountered:
I have a page with several models, arranged as array, and they have a file_input control.
But the attribute never gets the UploadedFile object because of differences in the name of the files in the $_FILES array.
I got around this problem by using a third check in BeforeValidade event. Maybe you guys want to use this solution in yii2-upload-behavior.
The text was updated successfully, but these errors were encountered: