Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internet Explorer removes .exe extension from download when followed by URL parameters

I am serving files from Amazon S3 now, and I generate a secure URL using the API. Works great everywhere except for people downloading .exe files in IE. I have tested this on IE 8 and 7.

If running a local webserver you can test by putting notepad.exe in your web root. Go to http://localhost/notepad.exe (or equivalent) Now try http://localhost/notepad.exe?

It should save the file as notepad, without extension. Is this a 'feature' because googling it is coming up with nothing. Thanks to the whole issue of IE extensions, you can't search for anything on file extensions.

Also, if the file has multiple periods in the name, it sometimes gets a [1] or [] added to the end.

Any ideas? Docs on this terrible behavior? It seems like it must be a security feature, but I have yet to find an option to disable it.

And as always, thank you. Tim

like image 559
Tim Reynolds Avatar asked Feb 02 '10 16:02

Tim Reynolds


2 Answers

We had the same problem when serving files from S3. Turns out you need to set the content-disposition correctly for IE to handle the files correctly. Namely, the HTTP header

Content-Disposition: attachment; filename="text.exe"

This article describes in a little more detail: http://www.jtricks.com/bits/content_disposition.html

like image 183
aaron Avatar answered Oct 21 '22 22:10

aaron


There's a long story here, but the simple workaround is to do this:

http://www.example.com/dl/test.exe?mysecret=12321412&FixForIE=.exe

As for the trailing [1] or whatnot, no, there's not really anything you can do about that if the user happens to have downloaded from that URL before.

like image 37
EricLaw Avatar answered Oct 21 '22 23:10

EricLaw