我是Laravel 5.6的新手,我正在尝试使用存储将文件从控制器上载到S3服务器。 我的控制器代码:
public function uploadPhoto(){
$uploadedFile = 'images/p012mrfb.jpg';
$s3 = Storage::disk('s3');
$s3->put('p012mrfb.jpg', file_get_contents($uploadedFile));
}
我已经使用cmd安装了适用于PHP的S3 SDK和League / flysystem-aws-s3-v3〜1.0。
此外,在.env文件中,我填写了以下字段:
AWS_KEY="XXXXXXXX"
AWS_SECRET="XXXXXXX"
AWS_REGION="ap-south-1"
AWS_BUCKET="XXXXXXX"
在filesystem.php文件中,我在磁盘中添加了s3凭据。
's3' => [
'driver' => 's3',
'key' => env('xxxxxx'),
'secret' => env('xxxxxxx'),
'region' => env('ap-south-1'),
'bucket' => env('xxxxxx'),
],
但是我遇到一个错误:
Missing required client configuration options: region: (string) A "region" configuration value is required for the "s3" service (e.g., "us-west-2"). A list of available public regions and endpoints can be found at http://docs.aws.amazon.com/general/latest/gr/rande.html.
欢迎提供任何解决错误的帮助。