I have a laravel 10 app and added an image upload. The image is getting uploaded to
/storage/app/public/user.name/image.jpg
The storage is also linked with: php artisan storage:link. I can see that the storage is linked correctly, since in the /public folder, I can see the link to /storage/app/public
Currently, I can get the image by visiting: http://localhost:8000/storage/user.name/image.jpg
However, I want the image to be visible under: http://localhost:8000/user.name/image.jpg
.
At least thats how it worked for me in previous laravel apps.
Now for the filesystem. The env var was: FILESYSTEM_DISK=local
and I changed it to FILESYSTEM_DISK=public
.
I did that because the disks
array in the filesystems.php tells me that "public" has the "root" at storage_path('app/public')
, which seems right to me.
But I have the feeling that it does absolutely nothing, cause even if I add "s3" in there, I can see the image under the storage URL.
Not sure what to do here?
2
Answers
For that you’d have to link your public storage path using:
php artisan storage:link
This will create a symbolic link, check docs here:
https://laravel.com/docs/10.x/filesystem#the-public-disk
try to change the
url
key indisks
inconfig/filesystems.php
.