I have been following the DoingITeasy channel on youtube in order to learn this framework. Completing lecture 17 on how to upload a file I managed to get the upload of the file working right as a bonus but I’m struggling to get the image displayed on the detail view widget. Any help would kindly be appreciated.
I have tried your code for the test picture and it worked. So I conclude that the path on my code is correct. I have a folder named ‘uploads’ on the web directory. The problem is what to write next to the $model on the value of the array.
But you can save the extension of the file also in db.
Then it will also work with other image-types.
$model->imageFile = UploadedFile::getInstance($model, 'imageFile');
// following attributes are available when you have catched the file