M
M
Max_Borisov2016-01-27 16:32:35
Yii
Max_Borisov, 2016-01-27 16:32:35

Yii file upload in admin?

There is a site on which there is an admin panel, the admin panel provides for adding / editing products. The product has an attached file. All solutions, recipes describe a method in which the file is attached without problems, but when you edit the product, you have to re-upload the file all the time. How to make it so that when editing a product, the file should be loaded only when it needs to be changed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander N++, 2016-01-27
@sanchezzzhak

Purely telepathically, probably like this
Remove the check for a required field from the rules
Where the value assigned to the model is added something like this

if(!empty($filePath)){
$model->image_url = $filePath
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question