【问题标题】:Digitalocean Spaces Laravel App - Missing regionDigitalocean Spaces Laravel 应用程序 - 缺少区域
【发布时间】:2020-11-28 00:38:26
【问题描述】:

我收到以下错误:

Missing required client configuration options: region: (string) A “region” configuration value is required for the “s3” service (e.g., “us-west-2”).

这是我的设置(XXX 隐藏我的信用):

.env 文件:

DO_SPACES_KEY=XXXXX
DO_SPACES_SECRET=XXXX
DO_SPACES_ENDPOINT=https://nyc3.digitaloceanspaces.com
DO_SPACES_REGION=NYC3
DO_SPACES_BUCKET=XXXX

filesystems.php 文件(在磁盘下):

 'do_spaces' => [
        'driver' => 's3',
        'key' => env('XXXXX'),
        'secret' => env('XXXXX'),
        'endpoint' => env('https://nyc3.digitaloceanspaces.com'),
        'region' => env('NYC3'),
        'bucket' => env('XXXXXX'),
        ],

也在 filesystems.php 文件中:

‘cloud’ => env('FILESYSTEM_CLOUD’, 'do_spaces’),

在视图文件中:

function addDocument(Request $req, $projId)
{
       
        $image = $req->file('uploadFile');


        $file_name = pathinfo($image->getClientOriginalName(), PATHINFO_FILENAME);

        $input['imagename'] = $file_name.'_'.time().'.'.$image->getClientOriginalExtension();

        //$destinationPath = public_path('/images');

        //$image->move($destinationPath, $input['imagename']);

        $destinationPath = $image->store('/', 'do_spaces');
        Storage::setVisibility($destinationPath, 'public');

        //$data = array('fid'=>$folderId,'fileLoc'=>$input['imagename'],'projId'=>$projId);
        //\DB::table('documents')->insert($data);

return back();

}

正如您在视图中看到的,我尝试将图像存储在空间中,然后将路径存储在代表空间路径的数据库中。

我无法让这个错误消失;有什么问题吗?

谢谢!

【问题讨论】:

    标签: php laravel storage digital-ocean


    【解决方案1】:

    'region' => env('NYC3'), 应该是'region' => env('DO_SPACES_REGION'),

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-16
      • 2019-08-31
      • 1970-01-01
      • 1970-01-01
      • 2019-10-30
      • 2016-12-23
      • 2017-11-20
      • 2017-01-11
      相关资源
      最近更新 更多