Wednesday, January 19, 2022

[FIXED] Not able to access image stored in Storage folder in Laravel 5.5

Issue

I am trying to access an image in the url which is stored in the /storage folder.

Image Stored Path:

Project/storage/app/public/default.png

According to Laravel 5.5 docs, your publicly accessible files should be put in directory

storage/app/public

So I did the same, but when I try to access the image as:

http://localhost:8000/storage/default.png

then it doesn't work.

I tried the following command:

php artisan storage:link

but it throws an error:

The "public/storage" directory already exists.


Solution

First use php artisan storage:link

Then you can access all public path using /* like:

http://localhost:8000/default.png

Above command allow you to get images directly from public path!

Hope this helps you!



Answered By - Hiren Gohel

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.