Cuploadedfile Saveas Not Saving Image Into The Directory

why the file is not saving ??

Hi

check this

http://www.yiiframework.com/wiki/2/how-to-upload-a-file-using-a-model/

after of that make the appropriate changes to adjust to your code (step by step) and will be the error.

also set temporarly $fileName = ‘testfile.jpg’

Inform us to help other member to find out solution for similar issues :)

Hi friend thanks for the reply, finally i have found that the file is saving but not in the path i have given, it is storing the file in the assets folder with a random folder name. please tell me how to solve it.

Please how set the "$rnd"

also use "{$rnd}-{$uploadedFile->name}" instead $fileName = "{$rnd}-{$uploadedFile}";

for testing use this


var_dump($rnd);

var_dump(Yii::app()->basePath.'/../image/'.$fileName);

really Thanks for the suggestion mate.Now it is working.

actually previously i followed the below post they didn’t used like uploadedfile->name anyhow thanks for the help

how-to-upload-image-photo-and-path-entry-in-database-with-update-functionality