0

流明 6.3.4 / PHP 7.3.9

尝试从表单数据上传文件。收到此错误:Disk [qr_uploads] does not have a configured driver.

引导程序/app.php

$app->configure('filesystems');
$app->register(Illuminate\Filesystem\FilesystemServiceProvider::class);

配置/文件系统.php

<?php

return [
    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
        'permissions' => [
            'file' => [
                'public' => 0664,
                'private' => 0600,
            ],
            'dir' => [
                'public' => 0775,
                'private' => 0700,
            ],
        ],
    ],
    'qr_uploads' => [
        'driver' => 'local',
        'root' => storage_path('qr_uploads'),
        'permissions' => [
            'file' => [
                'public' => 0664,
                'private' => 0600,
            ],
            'dir' => [
                'public' => 0775,
                'private' => 0700,
            ],
        ],
    ]
];

控制器.php

$upFile = $request->file('uploading');    
$storedPath = $upFile->store('e_'.$entityId, 'qr_uploads');

得到上述错误。目录app/storage/qr_uploads存在且可写。有任何想法吗?

4

1 回答 1

0

不幸的是,Laravel/Lumen 文档对配置文件过于敏感。正确的config/filesystems.php文件应该包含“disks”属性:

<?php

return [
    'disks' => [
        'local' => [...]
]

那是一回事。与 Lumen 相关的另一件事(我不确定 Laravel) - 您必须明确安装 Flysystem 依赖项!

composer require league/flysystem

有时我真的希望 Lumen/Laravel 文档对这样的细节有点具体。:/

于 2020-09-04T09:29:55.213 回答