简体   繁体   English

Laravel 5.2 AWS S3存储桶映像上传错误

[英]Laravel 5.2 AWS S3 Bucket image upload Error

I want to upload my image files into my s3 bucket.but got error 我想将图像文件上传到s3存储桶中,但出现错误

my code 我的密码

$image = $request->file('photo_one');
$imageFileName = time() . '.' . $image->getClientOriginalExtension(); 
$s3 = \Storage::disk('s3');
$filePath = '/products/' . $imageFileName;
$s3->put($filePath, file_get_contents($image), 'public');

My File System Configuration 我的文件系统配置

's3' => [
    'driver' => 's3',
    'key'    => 'xxxxx',
    'secret' => 'xxxxx',
    'region' => 'Oregon',
    'bucket' => 'xxxxx',
],

I am getting error 我遇到错误

        Error executing "PutObject" on "https://s3.Oregon.amazonaws.com
    /xxx/1455525865.jpeg"; AWS HTTP error: cURL 
error 6: Could not resolve host: s3.Oregon.amazonaws.com
    (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

as per my understanding, you are not using the proper region for your bucket. 据我了解,您没有为存储桶使用适当的区域。 You cannot use Oregon , follow this link, find the exact region for your bucket located in. AWS Regions 您无法使用Oregon ,请点击此链接,在其中找到您的存储桶的确切区域。AWS Regions

Edited eg: try this region us-west-2 编辑例如:尝试这个地区us-west-2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM