T
T
Thorsen2016-12-12 17:08:24
Laravel
Thorsen, 2016-12-12 17:08:24

How to get working url to uploaded file in Laravel?

I upload images to local according to all the rules (creating a link from 'app/storage/public' to 'public/storage'). Images are loaded there, no problem. I write the addresses of the images to the database, but I can't display the images by their url's. It turns out that the images are in "public/storage/"+filename. But if we issue this link in the src of the img tag, there is no image, and for this link we get only "NotFoundHttpException".
Active Google did not help, stackoverflow too. Tell me, what's the problem? Am I using the wrong url or how can I access these files at all? storage_path does not offer, it gives the full path in the system starting with the drive letter.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vlad Tokarev, 2016-12-14
@Thorsen

Check the permissions on the created folder, uploaded files and symbolic link.
Thorsen , I am writing my comment as a separate answer, on your advice)

O
Oleg, 2016-12-12
@ollisso

What's your mess :)
1. storage - needed for data that should not be directly available to the client.
2. public - a folder that is available to the client.
You can of course do it through the link as you did, but it's a bit strange. storage - maybe a google drive as well, how do you make a symlink then?
4. if you made a symlink, then check it like this: img src='storage/filename'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question