phplaravel-5.6

Laravel 5.6 storage link already exists but i am getting 404 error when trying to get a file from the public folder


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?


Solution

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

    php artisan storage:link