S3 view file in browser instead of download






















Asked 8 years, 1 month ago. Active 6 years, 8 months ago. Viewed 24k times. Sort of an inverse download attribute. Is there such a thing?

Ted Nyberg. Ted Nyberg Ted Nyberg 6, 7 7 gold badges 36 36 silver badges 64 64 bronze badges. My guess is "in browser" viewing is only available through some kind of plug-in. Weird thing is that some PDF files are opened for viewing in the browser, others prompt a download. The files are hosted on Amazon S3 and I don't want my app to download them, change the headers and then serve them to the client. Add a comment.

Active Oldest Votes. Nico Nico 1 1 gold badge 8 8 silver badges 20 20 bronze badges. The Overflow Blog. Who owns this outage? Building intelligent escalation chains for modern SRE. Podcast Who is building clouds for the independent developer?

Featured on Meta. Now live: A fully responsive profile. Reducing the weight of our footer. Linked 5. Related 0. Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled. Accept all cookies Customize settings. As you can imagine, there are so many possibilities here. Is it the video player or the video itself or is it Amazon? However, since the video plays on another S3 account just fine the issue must be with the settings in Amazon.

After quite a bit of time spent finding the solution, the culprit was in the metadata for that file. Not sure what was used to originally upload the file. So if you are encountering this issue, make sure the correct metadata is set. The browser will check the content-type value, and if it isn't something it knows how to display it will always just download the file.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.

Learn more. Asked 4 years, 1 month ago. Active 1 year, 10 months ago. Viewed 15k times. So you can force a download by using Content-Disposition: attachment Content-Disposition: inline is the default and should display in the browser, and it does in fact work with most files like PNG, JPG, etc.



0コメント

  • 1000 / 1000