The headers included in the sample code (content-type and content-disposition) will cause most browsers to do the right thing, although we have seen bugs in even a couple of modern browsers. These headers along with other pertinent information are discussed in the Returning Non-HTML Content section of the
Returning Content to the Browser page of the FoxWeb documentation.
FoxWeb Support Team support@foxweb.com email |
Sent by Alan Harris-Reid on 07/31/2002 01:45:11 PM:
I've amended my code to resemble the Foxweb code below, and the downloaded files are fine. My problem now is that when the user is presented with the download save dialog, it says "You are about to download file Download" and the save folder dialog calls the file Download by default.
I think it's something to do with the fact that the script containing the code below is called DownLoad.fwx, and it is called from a link on another script using the code... There is no other code in the script. I am using IE6.
Click <a href="DownLoad.fwx?filename=Myzip.zip">here</a> to download.
The downloaded file is definitely MyFile.zip, but with the wrong filename. How do I get the download save dialog to say 'MyFile.zip' instead of 'Download'?
TIA
Alan
<% Response.ContentType = "application/x-zip-compressed" Response.AddHeader("Content-Disposition", "attachment; filename=MyFile.zip") * Read contents of file into string FileContent = FILETOSTR("MyFile.zip") * Specify size so that progress bar works properly Response.AddHeader("Content-Length", Server.ToString(LEN(FileContent))) Response.Write(FileContent) Response.End %> |