So What? You may ask. This sometimes may be confusing to users!
When you click on a file link in Internet Explorer you are presented with a dialog that has a Save and Open button. When you choose Save, the filename is under your control and the Save File Dialog will get the file name from the Hyperlink or Content-Disposition – Filename attribute. This works wonderfully and presents no room for confusion. The Open button is another story however.
If the hyperlink for the file is a static filename (for example: <a href=”testsheet.xlsx”>Download it</a> ) then the Open button will simply pass the Url off to the appropriate program (in this case Excel) and that particular program is responsible for opening the file. If the HTML header Content-Disposition: Attachment is specified however, Internet Explorer saves the file using the Internet Explorer cache. This cache is a temporary location and the algorithms used to create the file name are not under programmatic or user control. The end result is you may end up with a filename like “testsheet.xlsx”. Unfortunately this is not under you control as a developer and you must accommodate for this by educating the customer.
This use of the IE cache becomes very apparent when downloading filenames that contain non ASCII characters such as the Japanese character sets. Frequently I have seen links that create streamed files simply use ASCII file names so that the filename does not contain totally unrecognizable characters.
So is there any solution to the Open button not allowing you to have control over the filename? In theory you could write an ActiveX control to take over the downloading responsibilities. This would be some significant work however and prone to the security protection that Internet Explorer gives you. If streaming the file down, you could mess with the headers and attempt to suppress the Content-Disposition header, and in the case of the Office family of products this may allow you to bypass the bracketed name. I am not sure what sort of name you would wind up with then however, so it would still not be in your control. If you or your customer is concerned about the name of the file, then you probably will not want then opening the file in the temporary cache anyhow, so a little education will go a long way in resolving this issue in your own mind.