Laravel-Admin图片上传时的问题

关于laravel-admin进入有图片上传页面时,会提示未配置存储路径等信息.此时需要去配置.

查看config/admin.php里面有

   
   'upload' => [

        // Disk in `config/filesystem.php`.
        'disk' => 'admin',

        // Image and file upload path under the disk above.
        'directory' => [
            'image' => 'images',
            'file'  => 'files',
        ],
    ],


//此时告诉我们存储配置在admin,里,但config/filesystem.php里的disk配置如下:
    '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'),
        ],

    ],

有local,pulic,s3,此时我们可以配置一个admin,也可以将config/admin.php里的
disk=>'admin'改成disk=>'public' 让它指向public路径里去.


这就解决了报错的问题,但还没好,这只是存在storage/app/public里,所以我们还要再执行软链接一下:

php artisan storage:link

这样就好了.

  

猜你喜欢

转载自www.cnblogs.com/bing2017/p/11365117.html
0条评论
添加一条新回复