skip to Main Content

I recently deployed my Laravel application to a shared hosting server with ssh access, on my local machine every thing worked perfectly.
but the server is returning the following error:

failed to load resource the server responded with a status of 404 (not
found)

for the images stored in laravel_directory/storage/app/public/
i have successfully created symbolic link to public_html/storage by running

ln -sfv /home/dtruxpgw/repositories/SoukElfalah/storage/app/public/
storage

from the public_html directory
i had also tried both

ln -s /home/dtruxpgw/repositories/SoukElfalah/storage/app/public /home/dtruxpgw/public_html/storage

ln -s /home/dtruxpgw/repositories/SoukElfalah/storage/app/public /home/dtruxpgw/public_html

i have run also

php artisan storage:link

and

chmod 775 -R storage

when i run

ls -la /home/dtruxpgw/public_html/storage

i get

lrwxrwxrwx 1 dtruxpgw dtruxpgw 59 Feb 27 09:04
/home/dtruxpgw/public_html/storage ->
/home/dtruxpgw/repositories/SoukElfalah/storage/app/public/
in the cPanel the storage file exist and linked to laravel_directory/storage/app/public/
here it is the html code

<img class="card-img-top thumbnail" src="{{$img_name?asset('/storage/images/thumbs/'.$img_name) : asset('/storage/images/thumbs/default.png')}}" alt="{{$img_name}}">

i have been stacked here for two days now, any help i would really appreciate it
thank you in advance .

the error indicating the image not found but it exist  here
the storage symbolic link successfully created

2

Answers


  1. You missed one thing is that you can’t access the file system from the storage folder directly as you have written above. If you want to access it publicly upload your documents in public directory.

    You can only access files from the storage folder through route only.

    Login or Signup to reply.
  2. Move the thumbs folder with the images into public/img and remove the symlink. It makes no sense to do it like this.. Whatever is to be public should be in the public why should you store images into the storage folder?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search