I'm trying to upload some files to a specific "disk" in Laravel and then to retrieve the URL from these files.
Here is my config/filesystem.php
file:
'disks' => [
...
'thumbnails' => [
'driver' => 'local',
'root' => storage_path('app/public/pictures/thumbnails'),
'visibility' => 'public',
],
...
],
Here is the way I handle an uploaded file (very basic, just for testing purposes):
Route::post('upload', function(Request $request) {
$file = $request->file('file');
$path = $file->storeAs('/', 'myFile.'.$file->getClientOriginalExtension(), 'thumbnails');
return dd($path);
});
The file /storage/app/public/pictures/thumbnails/myFile.jpg
is created, which is fine, but $path
equals "myFile.jpg"
instead of the full path. First strange thing.
Then if I use:
$url = Storage::disk('thumbnails')->url('myFile.jpg');
$url
equals "/storage/myFile.jpg"
instead of "/storage/app/public/pictures/thumbnails/myFile.jpg"
.
Am I missing something ?