Does the image display correctly.
Why image uploaded with spatie-laravel-media-library-plugin not found under storage?
On laravel 10 / filamentphp 3 site I have added spatie-laravel-media-library-plugin and upoading file with comnponent :
SpatieMediaLibraryFileUpload::make('image')
->disk('local')
->preserveFilenames(),
I see row in media table and file is uploaded under /ProjectRoot/storage/app/app_media/5/ subdirectory, but in browser I see that 404 error is returned on
http://local-host.com/storage/app_media/5/wizdom.jpg
url
I found valid file under
file:///ProjectRoot/storage/app/app_media/5/wizdom.jpg
path
but
/ProjectRoot/public/storage/
subdirectory is empty.
I run several times commands
cd public
rm storage
cd ../
php artisan storage:link
INFO The [public/storage] link has been connected to [storage/app/public].
With output above that link was created with success.
How that can be fixed ?
"laravel/framework": "^10.35.0",
"filament/filament": "^3.0-stable",
"filament/spatie-laravel-media-library-plugin": "^3.1",
"spatie/laravel-medialibrary": "^10.15.0",
Thanks in advance!
I don't have experience with the media library but I think I see why it's not working. The symbolic link that you have created points to storage/app/public. However, the files are not stored there. They're located in storage/app/app_media, which is not accessible via the browser. This is likely what's causing the 404 errors.
You could change the disk driver to public to solve this as the files will then be saved in storage/app/public/app_media/.... Note that everyone can access these files.
SpatieMediaLibraryFileUpload::make('image')
->disk('public')
->preserveFilenames(),
Please or to participate in this conversation.