【问题标题】:change content type of files that have been uploaded to amazon s3更改已上传到 amazon s3 的文件的内容类型
【发布时间】:2014-03-31 09:09:35
【问题描述】:

我已将数千张图片上传到 amazon s3,我需要将它们的内容类型更改为图片。 我知道当我尝试 putObject 时我应该这样做

$this->s3->putObject(array(
        'Bucket' => $this->s3_bucket,
        'Key' => $file_name,
        'Body' => file_get_contents($tmp_name),
        'ACL' => 'private', 
        'ContentType' => 'image/jpeg'
    ));

但我需要为之前上传的所有文件这样做。 谢谢

【问题讨论】:

标签: amazon-s3


【解决方案1】:

这里是 S3Object API:

http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/S3Object.html#copy_to-instance_method

使用copy_to方法。

将 content_type 放入“Options Hash”中,在 Ruby 中测试正常。

【讨论】:

    猜你喜欢
    • 2015-08-13
    • 1970-01-01
    • 1970-01-01
    • 2011-04-27
    • 2017-04-22
    • 2014-11-05
    • 1970-01-01
    • 2018-02-24
    • 2018-04-24
    相关资源
    最近更新 更多