如何更改Amazon S3对象的内容类型 [英] How to change content type of Amazon S3 Objects

查看:121
本文介绍了如何更改Amazon S3对象的内容类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Amazon S3存储桶中的对象都是内容类型application/octet-stream.其中一些对象是PDF,有时是JPGGIFPNG之类的图像.如何将这些对象的内容类型更改为images/jpegapplication/pdf等?

The objects in my Amazon S3 bucket are all of the content type application/octet-stream. Some of these objects are PDFs, sometimes images like JPG, GIF, PNG. How can I change the content type of these objects to images/jpeg, application/pdf etc.?

可以通过Amazon Console批量完成吗?

Can it be done in batch through the Amazon Console?

我可以使用命令行吗?

还是通过PHP?

推荐答案

这是为所有类型 *.png

aws s3 cp \
       s3://BUCKET-NAME/ \
       s3://BUCKET-NAME/ \
       --exclude '*' \
       --include '*.png' \
       --no-guess-mime-type \
       --content-type="image/png" \
       --metadata-directive="REPLACE" \
       --recursive

这篇关于如何更改Amazon S3对象的内容类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆