akili
148
2
Laravel

Display an image

Posted 2 months ago by akili

i have this controller that saves th image path into a database

class UploadController extends Controller { public function profile() { return view ('upload'); } public function upload_image(Request $request){

    $this->validate($request,[
        'image' => 'required']);
    $upload = new Upload;

   // $upload-> id = Auth::user()->id;

    //   $profiles-> name = Auth::user()->name;
    //   $profiles-> email = Auth::user()->email;
    //   $profiles-> password = Auth::user()->password;
    //  $profiles-> remember_token = Auth::user()->remember_token;

    if(Input::hasFile('image')) {
        $file = Input::file('image');
        $file->move(storage_path() . '/uploads/', $file->getClientOriginalName());
        $url = URL::to("/") . '/uploads/' . $file->getClientOriginalName();

    }




    $upload-> file_name = $url;
    $upload->save();


    return redirect('/upload')-> with ('response','Profile Added successfully');

}

}

how can i display the img?

<img src="{{}}"

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.