不支持驱动程序[]。-Laravel 5.3

尼尔斯

我正在使用Backpackforlaravel设置网站的后端区域。我在ProjectCrudController中添加了一个图像字段

$this->crud->addField([
    'label' => "Project Image",
    'name' => "image",
    'type' => 'image',
    'upload' => true,
], 'both');

在我的模型项目中,我有一个这样变体

public function setImageAttribute($value)
{
    $attribute_name = "image";
    $disk = "public_folder";
    $destination_path = "uploads/images";

    // if the image was erased
    if ($value==null) {
        // delete the image from disk
        \Storage::disk($disk)->delete($this->image);

        // set null in the database column
        $this->attributes[$attribute_name] = null;
    }

    // if a base64 was sent, store it in the db
    if (starts_with($value, 'data:image'))
    {
        // 0. Make the image
        $image = \Image::make($value);
        // 1. Generate a filename.
        $filename = md5($value.time()).'.jpg';

        // 2. Store the image on disk.
        \Storage::disk($disk)->put($destination_path.'/'.$filename, $image->stream());
        // 3. Save the path to the database
        $this->attributes[$attribute_name] = $destination_path.'/'.$filename;
    }
}

在我的公共文件夹我有/上传/图像/文件夹中。

但是,当我要保存项目时,出现以下错误:

FilesystemManager.php第121行中的InvalidArgumentException:

不支持驱动程序[]。

在此处输入图片说明

filesystems.php文件在我的配置文件夹,如下所示:

<?php

return [

    'default' => 'local',

    'cloud' => 's3',

    'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key' => 'your-key',
            'secret' => 'your-secret',
            'region' => 'your-region',
            'bucket' => 'your-bucket',
        ],
        'uploads' => [
            'driver' => 'local',
            'root' => public_path('uploads'),
        ],

    ],

    'storage' => [
        'driver' => 'local',
        'root'   => storage_path(),
    ],

];

这可能是什么问题?我正在使用Laravel Homestead版本2.2.2

若昂·曼托瓦尼(JoãoMantovani)

在这里,您将定义$diskpublic_folder

public function setImageAttribute($value)
{
    $attribute_name = "image";
    $disk = "public_folder";
    $destination_path = "uploads/images";

但是在您的filesystem.php中,您没有public_folder磁盘

您需要创建一个新的“ public_folder”磁盘

'disks' => [

    'public_folder' => [
        'driver' => 'local',
        'root' => public_path('uploads'),
    ],

或将$disk变量重命名为另一个磁盘:

public function setImageAttribute($value)
{
    $attribute_name = "image";
    //Uploads disk for example
    $disk = "uploads";

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

错误:“不支持驱动程序 [默认]。” 在laravel 8

Ubuntu 17.04中的Dota 2错误:不支持必需的OpenGL扩展“ GL_EXT_texture_compression_s3tc”。请更新您的OpenGL驱动程序

不支持驱动程序 [google]

Laravel 5 + Homestead + HHVM + PGSQL =未找到驱动程序

Laravel 5实现多个Auth驱动程序

Laravel 5 PDOException找不到驱动程序

Mongo Go驱动程序的DocumentCount不支持$ nearSphere

odbc驱动程序不支持请求的属性

不支持社交名流驱动程序[VKontakte]

Zotac WiFi驱动程序-不支持Linux

不支持 overlay2 驱动程序

Laravel Spark 4.0:不受支持的驱动程序 [mongodb]

Laravel 5:PHPUnit,没有可用的代码覆盖驱动程序

如何为Laravel 5设置数据库队列驱动程序?

当会话驱动程序设置为cookie时,laravel 5 url.intended损坏

Laravel 不支持 DELETE & PUT 请求?

Laravel缓存存储不支持标记

Laravel不支持Bcrypt哈希

Laravel 护照不支持密码方法

S3 不支持 GzipFile?

Docker Machine-通用驱动程序不支持启动

FilesystemManager.php第121行中的InvalidArgumentException:不支持驱动程序[]

将JDBI与不支持预准备语句的JDBC驱动程序一起使用

PHP Postgres PDO驱动程序不支持准备好的语句吗?

MongoDB $ first不支持的错误C#驱动程序

GLFW:创建窗口时,“ WGL:驱动程序似乎不支持OpenGL”错误

失败的Docker构建没有日志-“配置的日志记录驱动程序不支持读取”

django:数据库驱动程序不支持现代数据时间类型

wine为什么不支持内核模式驱动程序?