流明:上传文件/磁盘没有配置的驱动程序
Lumen: Uploading a file / Disk does not have a configured driver
流明 6.3.4 / PHP 7.3.9
正在尝试从表单数据上传文件。收到此错误:Disk [qr_uploads] does not have a configured driver.
bootstrap/app.php
$app->configure('filesystems');
$app->register(Illuminate\Filesystem\FilesystemServiceProvider::class);
config/filesystems.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,
],
],
]
];
controller.php
$upFile = $request->file('uploading');
$storedPath = $upFile->store('e_'.$entityId, 'qr_uploads');
出现上述错误。目录 app/storage/qr_uploads
存在且可写。有什么想法吗?
不幸的是,Laravel/Lumen 文档对配置文件过于模糊。正确的 config/filesystems.php 文件应包含“磁盘”属性:
<?php
return [
'disks' => [
'local' => [...]
]
这是一回事。与 Lumen 相关的另一件事(我不确定 Laravel)——你必须显式安装 Flysystem 依赖项!
composer require league/flysystem
有时我真的希望 Lumen/Laravel 文档对像这样的细节有一定的针对性。 :/
流明 6.3.4 / PHP 7.3.9
正在尝试从表单数据上传文件。收到此错误:Disk [qr_uploads] does not have a configured driver.
bootstrap/app.php
$app->configure('filesystems');
$app->register(Illuminate\Filesystem\FilesystemServiceProvider::class);
config/filesystems.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,
],
],
]
];
controller.php
$upFile = $request->file('uploading');
$storedPath = $upFile->store('e_'.$entityId, 'qr_uploads');
出现上述错误。目录 app/storage/qr_uploads
存在且可写。有什么想法吗?
不幸的是,Laravel/Lumen 文档对配置文件过于模糊。正确的 config/filesystems.php 文件应包含“磁盘”属性:
<?php
return [
'disks' => [
'local' => [...]
]
这是一回事。与 Lumen 相关的另一件事(我不确定 Laravel)——你必须显式安装 Flysystem 依赖项!
composer require league/flysystem
有时我真的希望 Lumen/Laravel 文档对像这样的细节有一定的针对性。 :/