mardi 22 décembre 2015

Laravel 5.1 - Move uploaded file

I am trying to upload to the server a photo avatar. I have an ajax function that works correctly and uploads a photo to a tmp folder. The controller returns the original name and the tmp file path and saves to hidden fields.

What I need is when I save the model, move the tmp file from the tmp folder to the avatars folder (created by me inside public/images/avatars).

I have tried with Storage::get($input['file_to_move'])and get a FileNotFoundException (although the file really exists). How can I get a var $file with the file to do $file->move($avatars_path).

Thanks In advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire