【问题标题】:The specified key does not exist - While copying S3 object from one bucket to another指定的键不存在 - 将 S3 对象从一个存储桶复制到另一个存储桶时
【发布时间】:2014-10-18 08:50:08
【问题描述】:

我正在尝试将 S3 对象从一个存储桶复制到另一个存储桶,响应如下所示 -

`object(stdClass)#24 (3) { 
          ["error"]=> array(2) { 
              ["code"]=> string(9)
               "NoSuchKey" ["message"]=> string(33)
                "The specified key does not exist." 
       }
          ["code"]=> int(404) ["headers"]=> array(1) {
      ["type"]=> string(15) "application/xml"
    } 
 }

`

这是代码的外观 -

var_dump($this->s3->copyObject('bucket_1','bucket_1/'. images/1.jpg, 'bucket_2', 'bucket_2/images')).die();

根据 copyObject 的方法签名,我需要提供 Source object URI 和 Destination object URI。

谁能帮我看看这里出了什么问题?

谢谢。

【问题讨论】:

    标签: amazon-web-services amazon-s3 amazon


    【解决方案1】:

    在查看亚马逊文档几个小时后,我终于修复了它。

    这是 S3 对象键 -http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-keys

    由于 S3 是一个平面文件系统,文件夹包含在键中,

    $this->s3->copyObject('bucket_1','images/1.jpg, 'bucket_2', 'images/copy_of_2.jpg');
    

    ACL 也可以作为第五个参数传递。

    【讨论】:

      猜你喜欢
      • 2021-07-28
      • 1970-01-01
      • 2018-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-07
      • 2018-11-22
      • 1970-01-01
      相关资源
      最近更新 更多