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

dyiroooo's avatar

Cannot Retrieve an image in a symbolic link in Hostinger

PS: It works on my localhost

and this is a column from my table file_path: public/images/AXrmF7am6L9gHfPItSYxNg6ObmpJDSFWuuTsCces.jpg

I already did the command php artisan storage:link and this is how I save the images: $path = $uploadedFile->store('public/images'); and this is how I fetch it $image->url = str_replace('public/', 'storage/', asset($image->file_path)); and the result is this https://mydomain/storage/images/AXrmF7am6L9gHfPItSYxNg6ObmpJDSFWuuTsCces.jpg just like in my localhost but when I uploaded the project on hostinger it does not work anymore.

0 likes
5 replies
Snapey's avatar

You should not have public in your URLs. your \ should be the public folder

dyiroooo's avatar

@Snapey so, am I gonna change the way of inserting a file or the way of retrieving it?

Snapey's avatar

@dyiroooo no you are going to change the document root of your application, otherwise you will keep having issues like this, plus expose your application to security risks

Archiruz's avatar

Sorry for reviving old thread. I just want to contribute to help future readers who are probably facing same issue. I solved this by setting storage/app/public directory permission to 755 recursively. You can do it via Hostinger file manager or by SSH, whichever method you prefer.

jlrdw's avatar

@Archiruz You still need to point to public as your document root, there are many past post explaining the correct setup for laravel.

1 like

Please or to participate in this conversation.