I have a problem with symlink. after I run this command php artisan storage:link
the uploaded images are showing in the public and storage folder.
I can display my img by using this code
<img src="{{ url('/storage/app/public/Attachments/test.png') }}" alt="">
but after a day the shortcut of the images folder in public has gone and when I run the php artisan storage:link
it says it has been already linked.
my problem now is i cannot display the images.
i saw a similar question but it doesn’t work for me. please help guys. thanks and staysafe.
Advertisement
Answer
This happens if you are moving the project from one computer to another. When you copy the folders over to another machine, it sees the symlink
folder as just another folder. So when you run php artisan storage:link
it will just say that you already have the symlink
created but your files won’t display because the shortcut to folder
or symlink
does not actually exist.
Solution:
What you need to do is go to your public folder and delete the storage folder. Then run the php artisan command again and your problem will be solved.