質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

Q&A

1回答

4183閲覧

AWSのEC2よりS3に写真をアップしたい

kishiuser0

総合スコア11

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

0グッド

0クリップ

投稿2018/01/26 07:30

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

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

region はfactory で指定します

投稿2018/01/26 09:21

kero1209

総合スコア431

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kishiuser0

2018/01/26 10:41

そうでした。 ありがとうございました。 無事アップすることができました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問