I'm using laravel 5.6 and i wanted to create my custom disk for uploading images
and i received this error
InvalidArgumentException Driver [] is not supported.
this is how i save file in controller
$cover = $request->file('cover_image');
$extension = $cover->getClientOriginalExtension();
Storage::disk('test')->put($cover->getFilename().'.'.$extension, File::get($cover));
this is my config/filesystems.php
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'test' => [
'driver' => 'local',
'root' => storage_path(),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public/asghar'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
the error occurred because my configuration was cached.
probably I accidentally used config:cache or sth similar.
the issue resolved by clearing the config cache using this command
php artisan config:clear
Related
I am trying to run a copy of a website locally but for some reason none of the images work. They are stored on an S3 bucket.
In my config/filesystems.php the default is s3:
'default' => 's3',
My keys are the same as on the live site:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID', 'key'),
'secret' => env('AWS_SECRET_ACCESS_KEY', 'key'),
'region' => 'eu-central-1',
'bucket' => 'storage.website.nl',
'cloud' => 'cloud.website.nl'
],
],
The only difference is my storage/app does not have a public folder with all the media in it like on the live site. But this should be created I think with something similar like php artisan storage:link except this command does not work in laravel 5.2.
What can I do to fix that?
I have hosted my laravel application, before this file uploads and everything was working fine, but after I put it on cpanel, File uploading is nolonger working.
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
this is my code, may someone help. in my .env file I inserted my app url for the website which is working file except for file upload
Regards
I am using file system storage to upload files. When I change filesystem_driver from local to public I get this error :
vendor/league/flysystem/src/Adapter/Local.php:367
public function setVisibility($path, $visibility){
$location = $this->applyPathPrefix($path);
$type = is_dir($location) ? 'dir' : 'file';
$success = chmod($location, $this->permissionMap[$type][$visibility]); // line 367
if ($success === false) {
return false;
}
Disk settings
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'permissions' => [
'file' => [
'public' => 0664,
'private' => 0600,
],
'dir' => [
'public' => 0775,
'private' => 0700,
],
],
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
I tried to change the file permissions according to this post, but it doesn't work. If I change the filesystem_driver to local I cannot display the pictures in front end. This is a local development environment WSL Ubuntu 18.
What do I do wrong here?
problem was cmod is not support under ntfs file system https://github.com/Microsoft/WSL/issues/81
I have just integrated laravel-admin in my Laravel project. When I try to get login then it shows me an error message at the top of every inner pages.
Please check the screenshot:
And here is the 'disks' array from my filesystems.php:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],
I have tried to find out the issue but nothing helped.
may be you need to add admin to disks array like this
'disks' => [
'admin' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],
Anyone else had this issue:
I set my filesystems.php config defualt from local to cloud (which is set to my s3) and I get this error with my storage code:
$path = $request->file('avatar')->store('avatars'); -> in my UserController
Error : Driver [] is not supported.
If I leave the filesystems config to stock and just run this code the image uploads to my s3 fine
$path = $request->file('avatar')->store('avatars', 's3'); -> in my UserController
shouldnt $path = $request->file('avatar')->store('avatars'); run to what ever the default is without passing the specific driver? I tried 'default' => 's3', and that gets the same error
CONFIG DRIVERS
'default' => 'local',
'cloud' => 's3',
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],
I guess, that whether your example with manually typing a storage to the store() function works well, you can have a problem with storage config.
Could you, please, show your configuration file with storage types?