Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: Content-Disposition Attachment Header Does Not Save File


View products that this article applies to.

Symptoms

A Web server that uses the Content-disposition: attachment HTTP header to force a file download should prompt the user to open or save the file; however, in Internet Explorer 5.5 Service Pack 1 (SP1), the user is prompted to open or save the HTML file instead.

↑ Back to the top


Resolution

To resolve this problem, refer to the hotfix that is described in the following Microsoft Knowledge Base article:
281119 Internet Explorer Saves HTML Content Instead of the Active Document
In addition, a fix for this problem is incorporated in Microsoft security bulletin MS01-015:

WORKAROUND

There are several ways to work around this problem:
  • Bypass Content-disposition, and use either an ActiveX control or a Java applet to download files to disk.
  • Use the Save As command from the pop-up menu.
  • Use the Internet Explorer download behavior instead. (This is for text-based files only).
  • Use a window.showModalDialog of an HTML page that does a document.write of a hidden IFRAME with the source pointing to the file.

↑ Back to the top


Status

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Create an HTML Page with an anchor tag that points to the file:
    <HTML>
    <BODY>
    Click <a href=test.txt>here</a> to download file
    </BODY>
    </HTML>
    					
  2. Add the HTML Response Headers for the file by using your Web Server software:
    Content-Type = application/download
    Content-Disposition = attachment; filename=test.txt
  3. In Internet Explorer 5.5 SP1, navigate to this new page.
  4. Click the hyperlink to the file.

↑ Back to the top


References

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
244757 HOWTO: Download a File Without Prompting
260519 HOWTO: Raise a File Download Dialog Box for a Known MIME Type
262042 FIX: Content-Disposition: Attachment Saves Wrong Filename for Unknown Extension
267991 FIX: Content-Disposition: Attachment Fails for Known Content Types
266305 FIX: Canceling Multiple File Downloads on Large File Causes Internet Explorer to Stop Responding
For more information about download behavior, see the following MSDN Web site: For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

↑ Back to the top


Properties

Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

↑ Back to the top


Keywords: KB279667, kbolehyperlink, kbnavigation, kbfix, kbbug

↑ Back to the top

Article Info
Article ID : 279667
Revision : 6
Created on : 5/3/2007
Published on : 5/3/2007
Exists online : False
Views : 274