user image

Joseph Morgan
Published in : 2021-12-14

[solved] All assets in laravel storage returns 404

Laravel

Laravel storage keeps giving me 404 however the file is already there, what should I do? this is my first time working with the Storage class, here is an example of the code which I use

$img_name = time() . '1.' . $img1->getClientOriginalExtension();Storage::disk('local')->put('/public/images/'.$img_name, $img);$link = url('/').'/storage/images/'.$file_name;

The image was uploaded successfully but and I can see it in the Finder but what should I do to figure out this issue? 
Thanks in advance

web-brackets.com

Comments

Mohamed Atef Date : 2021-12-14

Best answers

51

Best answers

51

Hello Joseph, Can you please try to run this command as you mentioned this is the first time to use Storage in your app?

php artisan storage:link

let me know if this works with you, Good luck

Joseph Morgan Date : 2021-12-14

Thank you so much, this works fine for me, I really missed this part while I am setting up the Storage

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Undefined Variable problem on Laravel 9.x
Publish date: 2022-03-06 | Comments: 3
Laravel API POST method returns 419
Publish date: 2022-08-03 | Comments: 1
Laravel error 419 page expired
Publish date: 2021-04-10 | Comments: 2
How can I use arabic words, paragraphs in the faker?
Publish date: 2022-03-06 | Comments: 1