I'm trying to upload images to the storage/app/public/
folder that is linked to the public folder from Laravel. My filesystems.php
is configured this way:
'default' => env('FILESYSTEM_DRIVER', 'public')
//rest of the code
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
And at my controller, I upload the image:
$file = $request->hasFile('imagem');
$file = $request->file('imagem')->isValid();
$upload = $request->imagem->store('instituicoes');
I want the file to be uploaded to this path storage/app/public/instituicoes
but when I use this code Laravel creates the 'instituicoes' folder at the storage/app
folder, not at the storage/app/public/
that I defined as storage path.
php artisan storage:link
?! – Soheil Rahmatstorage
word from URL. I offered this solution, but I think it could give you idea what you need to do to set other location thanstorage/app/public
for linking. – Tpojkaphp artisan storage:link
– Natan Rocha BatistaFILESYSTEM_DRIVER
environment variable? If it's notpublic
, then you're not storing to the public disk by default – Travis Britz