我需要将对象从存储桶复制到另一个存储桶。我尝试使用此代码:
$response = $s3->copyObject(
array(
'Bucket' => 'ORIGINAL BUCKET',
'Key' => 'OBJECT KEY',
'CopySource' => urlencode('ORIGINAL BUCKET' . '/' . 'OBJECT KEY')
), array(
'Bucket' => 'NEW BUCKET',
'Key' => 'NEW OBJECT KEY',
'CopySource' => urlencode('NEW BUCKET' . '/' . 'NEW OBJECT KEY')
)
);
但我收到一个错误类型 400 Bad Request:
object(Aws\S3\Exception\InvalidRequestException)[274]
protected 'response' =>
object(Guzzle\Http\Message\Response)[261]
protected 'body' =>
object(Guzzle\Http\EntityBody)[260]
protected 'contentEncoding' => boolean false
protected 'rewindFunction' => null
protected 'stream' => resource(299, stream)
protected 'size' => null
protected 'cache' =>
array (size=9)
...
protected 'customData' =>
array (size=0)
...
protected 'reasonPhrase' => string 'Bad Request' (length=11)
protected 'statusCode' => int 400
有人有一个将复制对象复制到另一个存储桶的真实示例吗?