5

I've created a symlink using the command:

php artisan storage:link

Then I've created a file in storage/app/public. Following the documentation, I could get the link to this file with:

asset('storage/file.txt')

Which returns in the html code:

http://127.0.0.1:8000/storage/psps.txt

But I am getting 404 error. Any help?

Don't Panic
  • 13,965
  • 5
  • 32
  • 51
ADEL NAMANI
  • 171
  • 1
  • 2
  • 12
  • can you try with `asset('file.txt')` ? – Teoman Tıngır Aug 17 '18 at 15:41
  • same thing , the first one i used seems to be correct because it's on official documentation – ADEL NAMANI Aug 17 '18 at 15:45
  • Does the webserver have read permissions to that file? – apokryfos Aug 17 '18 at 15:59
  • What operational system are you using? Because if you are using Windows, that could be windows permission problem. If you're using linux check the folder owner. – mad4n7 Aug 17 '18 at 16:16
  • I am assuming it is just a typo here - `file.txt` !== `psps.txt`? Is Laravel installed correctly, specifically did you [set up directory permissions](https://laravel.com/docs/5.6/installation#configuration)? What are the permissions on your newly created `file|psps.txt`? – Don't Panic Apr 16 '20 at 00:07

2 Answers2

24

Go to your project's public folder, and delete the storage folder, if it exists.
Then run this command line:

php artisan storage:link
SherylHohman
  • 16,580
  • 17
  • 88
  • 94
Mahmoud Ow
  • 354
  • 3
  • 6
0

Go to the project root and copy and paste this two command

rm -rf public/storage
php artisan storage:link
Jamil Ahmed
  • 284
  • 3
  • 17