I'm uploading an image with laravel using this code:
$logoPath = $request->file('logo')->store('uploads/clients');
It works fine, the file is uploaded to storage/app/uploads/clients/
.
Then, I run the command php artisan storage:link
to create the symlink in public and its created successfully. The problem is that this symlink shows only the files in "storage/app/public" but, as i said, my images are being saved in storage/app/uploads/clients
.
I already did this process in others projects and it works fine, I don't really know what I did different this time.
Any ideas?
It seems you are using the default disk which is local
that stores the files in storage/app
directory as configured in config/filesystems.php
, but what you want is public
disk which stores the files in storage/app/public
that is linked to the public directory by running php artisan storage:link
.
So here are some solutions:
Specify which disk you want to use:
$request()->file('logo')->store('uploads/clients', ['disk' => 'public']);
OR
config/filesystems.php
and link it with your uploads/clients
then change the default FILESYSTEM_DRIVER
in config/filesystems.php
to the new disk.OR
FILESYSTEM_DRIVER
to public
in config/filesystems.php
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.