LARAVELを使用しています
EC2のWEBサーバのコーディング
@php
$bucket = 'bucket';
$keyname = 'key';
$file_name = $FILES['upfile']['name'];
$uniq_file_name = date("YmdHis") . "" . $file_name;
// Instantiate the client.
$s3 = S3Client::factory();
try {
// Upload data.
$result = $s3->putObject(array(
'Bucket' => $bucket,
'Key' => $keyname,
'Body' => $uniq_file_name,
'ACL' => 'public-read',
'region' => 'ap_northeast_1'
));
// Print the URL to the object.
echo $result['ObjectURL'] . "\n";
} catch (S3Exception $e) {
echo $e->getMessage() . "\n";
}
@endphp
実行時のエラー
"""
Missing required client configuration options: \n
\n
region: (string)\n
\n
A "region" configuration value is required for the "s3" service\n
(e.g., "us-west-2"). A list of available public regions and endpoints can be\n
found at http://docs.aws.amazon.com/general/latest/gr/rande.html.\n
\n
version: (string)\n
\n
A "version" configuration value is required. Specifying a version constraint\n
ensures that your code will not be affected by a breaking change made to the\n
service. For example, when using Amazon S3, you can lock your API version to\n
"2006-03-01".\n
\n
Your build of the SDK has the following version(s) of "s3": * "2006-03-01"\n
\n
You may provide "latest" to the "version" configuration value to utilize the\n
most recent available API version that your client's API provider can find.\n
Note: Using 'latest' in a production application is not recommended.\n
\n
A list of available API versions can be found on each client's API documentation\n
page: http://docs.aws.amazon.com/aws-sdk-php/v3/api/index.html. If you are\n
unable to load a specific API version, then you may need to update your copy of\n
the SDK. (View: /var/www/keibabook_www/resources/views/manage/photopaddock_content.blade.php) (View: /var/www/keibabook_www/resources/views/m
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/26 10:41