PaulCatalin97's avatar

How to show image in view when upload?

this is my session

 $employer->save();

        if($employer){
            return redirect()->route('imageuploademployer')->withSuccess('S-a incarcat cu success!');
        }else{
            return redirect()->back()->withDanger('Nu s-a incarcat! A aparut o eroare.');

and here i want to display image from directory

 @if(session()->has('success'))
                    <div class="alert alert-success">
                        {{ session('success')}}
                    </div>
                    <div class="img2">
                        <img src="{{$employerimage->image}}">
                    </div>
                @endif
0 likes
4 replies
Neven's avatar
Neven
Best Answer
Level 18

Hi, in the balise img the source file src="" must redirect to your image file. If your file is in /public/imgs/myfile.png and if in $employerimage->image is myfile.png

<img src="{{asset('/imgs/'.->image)}}">

I hope i helped :)

Please or to participate in this conversation.