【问题标题】:Laravel Driver error - Driver [] is not supportedLaravel 驱动程序错误 - 不支持驱动程序 []
【发布时间】:2017-05-05 23:28:16
【问题描述】:

其他人有这个问题:

我将我的 filesystems.php 配置 defualtlocal 设置为 cloud(设置为我的 s3)并且我的存储代码出现此错误:

$path = $request->file('avatar')->store('avatars'); -> 在我的用户控制器中

错误:Driver [] is not supported.

如果我将文件系统配置保留为库存并仅运行此代码,则图像会很好地上传到我的 s3

$path = $request->file('avatar')->store('avatars', 's3'); -> 在我的用户控制器中

不应该$path = $request->file('avatar')->store('avatars'); 在不传递特定驱动程序的情况下运行默认值吗?我试过'default' => 's3', 得到同样的错误

配置驱动程序

'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'),
        ],

    ],

【问题讨论】:

    标签: php laravel


    【解决方案1】:

    我猜,如果您的示例在 store() 函数中手动键入存储是否运行良好,则存储配置可能存在问题。 能否请您显示您的配置文件以及存储类型?

    【讨论】:

    • 是的,$path = $request->file('avatar')->store('avatars', 's3'); 已成功上传到我的 S3 存储桶。我将添加我的配置,但我认为这不是配置问题或我的 env 文件
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-29
    • 2016-09-09
    • 2018-01-15
    • 1970-01-01
    • 1970-01-01
    • 2016-06-30
    相关资源
    最近更新 更多