swaraj's avatar

File `{$path}` does not exist error

hello, Can you please help me in some error,i am stuck in that error from two days. i have work in laravel multiple images upload.but whenever i upload the images it will show below error msg..

Spatie\MediaLibrary\Exceptions\FileCannotBeAdded\FileDoesNotExist File D:\xampp\htdocs\abc\storage\prop_images/5f211fbd7fa1a_p1.jpg does not exist

i have read all sources but no one give me exact solution.

0 likes
2 replies
aurawindsurfing's avatar

Hey @swaraj

From a quick look there is error in your path you have:

prop_images/5f211fbd7fa1a_p1.jpg

it should be

prop_imagesf211fbd7fa1a_p1.jpg

The second thing is that it should be accessing the via public path and you try to access it directly, did you link your storage to your public folder? Here is the info: https://laravel.com/docs/master/filesystem#the-public-disk

You should run:

php artisan storage:link

And then your path should work like that:

asset('storage/prop_images/5f211fbd7fa1a_p1.jpg');

I'm not sure about the ticks but for sure they should be facing all one way ;-)

Hope it helps!

swaraj's avatar

Thank you @aurawindsurfing sir for your response. :) There path is correct and when i create d it it will store and access that file from that path. And i use this php artisan storage:link. So it works but when I will restart that project next day it will show this error...

Please or to participate in this conversation.