Reputation: 41
I have a test.txt file stored in an S3 bucket and when i click on "Open", i want it to get downloaded but it is opening in the browser itself. I have tried setting Content-disposition to attachment but it did not work. Is there any way to force download text and json files from S3? Thanks in advance.
Upvotes: 0
Views: 2761
Reputation: 12259
When you click Open
in the S3 console, it sends response-content-disposition=inline
to S3 which overwrites whatever Content-Disposition
set on the object to inline
. Content-Disposition: inline
indicates that the content of this file can be displayed inside the Web page. This is why setting Content-Disposition
won't work in this case.
If you need to download the file (instead of opening it in the web page) from the S3 console, you can either
Open
Save as ...
Or
Download as
in the S3 web consoleUpvotes: 1