问题描述
我正在使用Panic Transmis并通过PHP脚本/API将PDF手动上传到AmazonS3.由于某些原因,浏览器中会显示某些内容,有些会强制下载.我已经检查了权限,似乎看不到任何问题,任何人都可以帮助您解释如何使PDF始终显示在浏览器中(除非用户另行指定).
I am uploading PDF's to AmazonS3 manually, using Panic Transmis and via a PHP script/API.For some reason, some display in your browser, and some force download.I have checked permission and can not seem to see any issues, Can anyone help explain how to make PDF's always display in browser ( unless the user specifies otherwise ).
我不认为这是浏览器问题.
I don't think it is as browser issue.
推荐答案
您需要更改Content-Type和Content-Disposition.
You need to change the Content-Type and Content-Disposition.
Content-Type: application/pdf;
Content-Disposition: inline;
使用AWS S3控制台,找到文件,然后使用上下文菜单(右键单击)选择Properties,然后将其放在Metadata下.
Using the AWS S3 console, find the file and using the context menu (right click) select Properties then it's under Metadata.
或通过编程方式对此进行更改: http://docs.aws.amazon.com/AWSSDKforPHP/latest/index. html#m = AmazonS3/create_object
Or change this programmatically:http://docs.aws.amazon.com/AWSSDKforPHP/latest/index.html#m=AmazonS3/create_object
这篇关于将PDF上载到Amazon S3并在浏览器中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!