Answer the question
In order to leave comments, you need to log in
Updating model with image in yii2?
Here I have a model in which there is an image (mandatory attribute) $model->image_file.
When we update a model with an image, it turns out that image_file is empty and a validation error occurs.
How can I make sure that the file is refilled during the update so that this does not happen?
Answer the question
In order to leave comments, you need to log in
image_file you should contain not a file, but a string, a file name. And for the file add 1 more attribute, for example file.
Then there will be no errors and validation will work normally, for the file separately and for its name separately
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question