Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Download Differences Between FF & IE 1

Status
Not open for further replies.

hererxnl

Technical User
Jul 8, 2003
239
US

I'm wondering if anyone else has had this problem...

I've been using this script for a while without issues for forcing a Open/Save dialog in IE & FF:
Code:
ContentType = "application/x-msdownload"
Response.Buffer = True
Const adTypeBinary = 1
Response.Clear
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath
ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName
Response.Charset = "UTF-8"
Response.ContentType = ContentType
Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Set objStream = Nothing
... and it has worked just fine.

Now I've been working on a new project and I'm running into problems using this script. The old project generated unique filenames based using vaiartions of Now() and the filenames contained no spaces.

The new project needs to push the literal name of the file which may or may not contain spaces. IE handles this fine but FF truncates the file name at the first space and displays an unknown file type.

I've resorted to the following, eventhough it goes against my better judgement to rely on "HTTP_USER_AGENT":
Code:
If InStrRev(Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") > 0 Then
	Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName
Else
	Response.AddHeader "Content-Disposition", "attachment; filename=" & Replace(strFileName, " ", "")
End If
Anyone have a clue about this??? I know FF adheres more strictly (& correctly) to web standards but this is driving me nuts.

Any help is greatly appreciated. As always, thanks in advance...

 

Thanks tlh. I actually JUST managed to figure out the same. You get a star for answering correctly though.

Here was my fix:
Code:
Response.AddHeader "Content-Disposition", "attachment; filename=""" & strFileName & ""

 
Thanks for the star! you know what they say about Great Minds!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top