A
A
Alexey Verkhovtsev2018-02-13 19:41:27
Laravel
Alexey Verkhovtsev, 2018-02-13 19:41:27

How to display uploaded image laravel?

Hello.
I upload the image like this and write it to the database

$path = $request->file('bugScreenshot')->store('screenshots');

And I get this path screenshots/kIQ2Qe4RADskwEgseUAjxsHz5vx1oDsQWeyN2MLN.jpeg
I need to display img in the view, I use this command php artisan storage:link
Next, I write this path
<img src="/storage/screenshots/kIQ2Qe4RADskwEgseUAjxsHz5vx1oDsQWeyN2MLN.jpeg" alt="">

But nothing... What am I doing wrong, point me in the right direction, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2018-02-13
@Alex_Wells

$f = $request->file('file');
$path = $f->storePublicly(static::UPLOAD_PATH);
$url = Storage::url($path)

in UPLOAD_PATH:
public/uploads

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question