File download dialog for photos hosted on Amazon S3
My web application will host full size photos on Amazon S3 and we use S3 as our media server. We also allow the users to download the full-size photos. Our web server is on a different hosting company. On our web application, how can we force a File Download dialog box instead of showing the photo in browser directly from an Amazon S3 URL? For example, the image url could be "http://my.s3.amazonaws.com/12345.jpg"
One solution would be to download the im开发者_开发知识库age to our web server which is running Django, and then force a file download dialog, but will cost double bandwidth and double the download time as well.
Thanks!
See if you can get S3 to specify the content type of the files as application/octet-stream.
I have just verified this. In the AWS management console you can select a file, click on Properties, select the Metadata tab and then set the Content-Type to "binary/octet-stream". If it's e.g. image/jpeg it will display in the browser. If it's changed to binary/octet-stream it forces the browser to download it instead.
精彩评论