Monday, February 27, 2017

how to upload and retrieve image on laravel

sorry for my language.

i need to save image for avatar and i don't know how to do it???

any one can give me simple code for save and retrieve image?

save image on folder , save image name at DB and finally retrieve on image tag? i have to do it by Query Builder

thanks for advance

i find this code but i can't find out anything

 if ($request->hasFile('avatar')) {
            $file = array('avatar' => Input::file('avatar'));
            $destinationPath = '/'; // upload path
            $extension = Input::file('avatar')->getClientOriginalExtension();
            $fileName = rand(11111,99999).'.'.$extension; // renaming image
            Input::file('avatar')->move($destinationPath, $fileName);
        }




via siros

Advertisement