I've tried a bunch of recommendations on forcing a download in IE6 rather than determine MIME type and open in browser, yet nothing works (even though it works fine in other browsers). Here's the code I've tried
Dim BlockOf, CountOf, objFile, objStrea
BlockOf = 10000
CountOf =
' Session is setup, and a file name (Request.Form("object") has been passed
If FSO.FileExists(Server.MapPath("download") & "\" & Session("username") & "\" & Request.Form("object")) The
Set objFile = FSO.GetFile(CStr(Server.MapPath("download") & "\" & Session("username") & "\" & Request.Form("object"))
' The filename you give it will be the one that is shown to the users by default when they save
Response.ContentType = "application/asp-unknown
Response.AddHeader "content-transfer-encoding", "binary
Response.AddHeader "content-disposition", "attachment; filename=" & objFile.Name & "
Response.AddHeader "content-length", objFile.Siz
Set objStream = Server.CreateObject("ADODB.Stream"
objStream.Ope
' Set as binary
objStream.Type =
Response.CharSet = "UTF-8
Response.Flus
' Load the file into the stream
objStream.LoadFromFile(CStr(Server.MapPath("download") & "\" & Session("username") & "\" & Request.Form("object"))
While objFile.Size > BlockOf + CountO
CountOf = CountOf + BlockO
Response.BinaryWrite objStream.Read(BlockOf
Response.Flus
Wen
Response.BinaryWrite objStream.Read(objFile.Size - CountOf
Response.Flus
Response.En
objStream.Clos
Set objStream = Nothin
Set objFile = Nothin
In particular, the AddHeader "Content-Disposition" line that is supposed to designate the initial filename does not work regardless of what I try. All it ends up displaying to the user is the parent folder hosting the site. Then when the download starts, the file cannot be found
As I said, if I try the code above in another browser it works fine in other browsers (both Mozilla/Firebird, and Opera) and according to the RFC, this should work
Any help would be appreciated. I've tried this on a number of different IE 6 installations, with 2000 and XP, and nothing makes any difference
fh.