Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS s3 file downloads are not working in Chrome (Works fine with IE, Mozilla, Safari)

I am using s3 to store my pdf files. But when i tries to download the files from s3 using chrome browser it doesn't do anything. It just refresh the page, no error, nothing ... But from other browsers i can download that file. When i checked in the console it gives 'Resource interpreted as Other but transferred with MIME type undefined.'

I got one thread from AWS https://forums.aws.amazon.com/thread.jspa?threadID=79493

But we can not tell user that go & disable this plugin & then download.

Is it a problem from AWS end?

I searched a lot but didn't get any solution. Please help me to resolve this issue.

Thanks, Vijay

like image 617
Vijay Kumbhar Avatar asked Dec 07 '11 05:12

Vijay Kumbhar


People also ask

Can I access S3 bucket from browser?

An S3 bucket can be accessed through its URL. The URL format of a bucket is either of two options: http://s3.amazonaws.com/[bucket_name]/

Can I read S3 file without downloading?

Reading objects without downloading them Similarly, if you want to upload and read small pieces of textual data such as quotes, tweets, or news articles, you can do that using the S3 resource method put(), as demonstrated in the example below (Gist).

Why is my S3 download so slow?

Large object size For very large Amazon S3 objects, you might notice slow download times as your web browser tries to download the entire object. Instead, try downloading large objects with a ranged GET request using the Amazon S3 API.

How do I access files on my S3 AWS?

In the Amazon S3 console, choose your S3 bucket, choose the file that you want to open or download, choose Actions, and then choose Open or Download. If you are downloading an object, specify where you want to save it.


1 Answers

I had this problem too. The solution it to force Chrome to download the PDF file instead of trying to open it in its reader.

In your GET request, append response-content-disposition=attachment. Refer to the S3 documentation on how to do this.

More details available here.

like image 121
James Lim Avatar answered Oct 17 '22 08:10

James Lim