[Solved] Force Amazon S3 File to Download instead of opening in browser

July 22, 2015

I was given a 47mb pdf to host on Amazon S3. I uploaded the file and grabbed the web url (the direct link to the file) yet when I was clicking it was forcing me to OPEN the file in my web browser. The result being that it takes longer to download and ties up your browser.

I needed the file to DOWNLOAD and I found it can be done this way.

If you are using S3 then you will be familiar already with something like Cloudberry S3 Explorer which allows you to easily navigate your S3 account and change file settings.

All you have to do is add some additional http headers and the file will download rather than open.

The http headers you need to add are: Content-disposition: attachment; filename=your-file-name.pdf

Below is some screenshots of how to do it in your s3 browser.

Force-Amazon-S3-File

Tags: