type while uploading an object is important

I need to know setting the content-type for an S3 object while uploading is important or it will take the default content-type automatically? Also, which is the good practice?

Also, I want to know if I set the content-type to some thing else (for ex: application/vnd.openxmlformats-officedocument.wordprocessingml.document) when uploading and specify the content-type as "application/octet-stream" when downloading, will it work?

Thanks in advance.


It depends on how you are going to use content-type.

As far as S3 is concerned, it doesn't matter.

But if you intend to transmit this file to a user via browser then it is good to have right content-type so that browser can identify file type and act accordingly instead of simply showing a "download file" dialog.

Right content type can help a browser to open the file with proper application either integrated with browser(like pdf reader) or stand alone application (like MS Word)

链接地址: http://www.djcxy.com/p/46878.html

上一篇: PHP:下载文件脚本不适用于iPad

下一篇: 在上传对象时键入很重要