rodrigobrito23's avatar

HOW SAVE THE IMAGE IN DB ON LARAVEL AND SHOW THE IMAGE IN A VIEW ?

guys, please, someone can help me, i have a form and i want save the image in the bd and show this in a view. i'm using laravel 5.3

0 likes
4 replies
rodrigobrito23's avatar

i see this link, but i'm brazillian and i'm not understand a lot the language english, but i'll try again.

someone have the code read, and post here a image of the code, because stay more easy for me understand. But, thanks all.

jdunsmore's avatar

//$path will hold the path to the image

$path = $request->file('yourfileinput')->store('public');

Then in your view call that path in to the img src attribute.

So you would store $path in your database somewhere, relative to what the image is for or if just a table of images.

Then in view print it out by calling the path into the img src attribute for whatever way.

e.g

@foreach($images as $image)
    <img src="$image->path" />
@endforeach

Hope you understand and this helps you.

1 like

Please or to participate in this conversation.