review the html source for the image, see what was generated
Jun 19, 2017
20
Level 6
Laravel storage goes to 404 page. (Symlink not working)
This is my url:
http://cakeandbake.dev/storage/app/thumbnail/qusrjRoVTlghf2JkSrfHciAMT4j8gycCMv0Rg7XD.jpeg
This should go to an image stored in the storage folder. I have symlinked the folder into my public using
php artisan storage:link
but for some reason it's giving me the 404 page.
This is how I call it inside my view, Am I doing this right?
{{ Storage::url('app/thumbnail/' . $recipe->feature_image) }}
Level 6
I've figured it out. It was the Symlink not working correctly. Following code got it working.
ln -s /Users/ashleybaker/code/cakeandbake/storage/ /Users/ashleybaker/code/cakeandbake/public
NOTE TO OTHERS WITH THIS PROBLEM.
You need to use the full directory path on your system due to the way symlinks work.
Working code:
ln -s /Users/_YOUR_COMPUTER_USERNAME_/_PATH_TO_YOUR_PROJECT_/storage/ /Users/_YOUR_COMPUTER_USERNAME_/_PATH_TO_YOUR_PROJECT_/public
Not working code:
ln -s _PATH_TO_YOUR_PROJECT_/storage/ _PATH_TO_YOUR_PROJECT_/public
What is
php artisan storage:link
This creates a public folder in your storage folder. In my case I did not want this and wanted the symlink the other way around.
1 like
Please or to participate in this conversation.
