Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shariff's avatar
Level 50

Not able to view image from storage folder in production

Hi all,

I have uploaded code to production after uploading code I cannot able to view image from storage folder. It is showing as Not Found. But the image is present in directory.

 <img src="{{ asset("storage/$image->url") }}">

I have created a symlink in server as well using php artisan storage:link . I tried all possible ways but nothing is working. The image link is coming like this my-domain.com/storage/products/1/sFXrF87KYyfPcago3tgqFnAQ4llDwOqbdCVXcd7A.webp

Thank you

0 likes
30 replies
SilenceBringer's avatar

@shariff what if you put the url in the browser?

Can you check that symlink was really created on the server?

SilenceBringer's avatar

@shariff maybe. try to create test file (not webp) in storage root and access it it browser directly.

1 like
Sinnbeck's avatar

But the image is present in directory.

What directory? What is the exact path to the image on disk?

Sinnbeck's avatar

@shariff that is not really answering my question. What is the exact path from the root of your laravel project?

Sinnbeck's avatar

@shariff that's an url. I am talking about on disk. Something like /storage/app/public/products/1/test-image.webp

Hint : it should be the above

shariff's avatar
Level 50

@sinnbeck @silencebringer When I uploaded a image instorage/app/public/test-image.webp and try to access using asset("storage/test-image.webp"). I can able to view the image. Same image I uploaded in storage/app/public/products/1/test-image.webp I cannot able to access it.

Sinnbeck's avatar

@shariff good. Correct location then

Is the file in /public/storage/products/1/test-image.webp as well?

Sinnbeck's avatar

@shariff ok weird then. Did you try it with any other file type? Like jpeg or png? Any chance that you have a route that matches the pattern?

shariff's avatar
Level 50

@Sinnbeck Yeah I tried it is same for all images Or it may be any permission issue for directory?

Sinnbeck's avatar

@shariff Just to rule out routes, can you try adding return; right after <?php in web.php? And if your routes are cached, try clearing them as well php artisan route:clear

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@shariff I assume the app stopped working when you did that?

Then I dont know sadly. Perhaps the server provider can spot some issue (which I then assume has to do with .htaccess or nginx)

1 like
DougReimers's avatar
  1. Make a public directory in public_html i do have folder in my public_html it's created when i ran artisan command, 2) i did 'url' => env('APP_URL').'/public/storage', but nothing changed still i can't get my images
shariff's avatar
Level 50

@sinnbeck @silencebringer Thank you so much for helping and spending your valuable time. Finally I can able to view the images after I change the directory permissions to 777. It is weird but in browser it was showing 404 not found. Thank you once again

Sinnbeck's avatar

@shariff Ok good to know. Never seen permissions give 404, but now I know that for next time :)

1 like
shariff's avatar
Level 50

@Sinnbeck In local it is working fine without assigning any permission. Only in server it is showing like that. May be some problem with server. If I add any new directory again I should assign a permissions or this will work?

'local' => [
    'driver' => 'local',
    'root' => storage_path('app'),
    'permissions' => [
        'file' => [
            'public' => 0777,
            'private' => 0600,
        ],
        'dir' => [
            'public' => 0777,
            'private' => 0700,
        ],
    ],
],

Please or to participate in this conversation.