Я пытаюсь интегрировать PHP Amazon SDK – s3 api. Я даю правильные учетные данные. Но я не уверен в параметрах putObject. Это код, который я пробовал:
try { $s3Client->putObject(array( 'Bucket' => $bucket, 'Key' => $filename, 'Body' => file_get_contents(drupal_realpath($file_path)), 'ACL' => 'public-read', )); } catch (S3Exception $e) {echo '<pre>';print_r($e); echo "There was an error uploading the file.\n"; } exit;
После выполнения запроса я получаю этот ответ:
Aws\S3\Exception\AccessDeniedException Object ( [response:protected] => Guzzle\Http\Message\Response Object ( [body:protected] => Guzzle\Http\EntityBody Object ( [contentEncoding:protected] => [rewindFunction:protected] => [stream:protected] => Resource id #219 [size:protected] => [cache:protected] => Array ( [wrapper_type] => PHP [stream_type] => TEMP [mode] => w+b [unread_bytes] => 0 [seekable] => 1 [uri] => php://temp [is_local] => 1 [is_readable] => 1 [is_writable] => 1 ) [customData:protected] => Array ( ) ) [reasonPhrase:protected] => Forbidden [statusCode:protected] => 403 [info:protected] => Array ( [url] => https://s3.amazonaws.com/my_test/ak1.jpg [content_type] => application/xml [http_code] => 403 [header_size] => 273 [request_size] => 320 [filetime] => -1 .........................................................................................................