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

怎甘沉沦 提交于 2019-12-10 01:58:48

问题


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


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/2185570/internet-explorer-removes-exe-extension-from-download-when-followed-by-url-para

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!