Binary File opening issues

joker77

Freshman
Joined
Sep 16, 2005
Messages
38
Location
Dublin
Hi

I'm experiencing different behaviour on different machines (all using IE6), and just wondering if anyone has any thoughts as to what the problem is.

I have a form that views a file. An ID is passed to the form, which does a lookup to the database and gets the file to open. It then checks which type of file it is, and uses the Response object to present the file to the User.

A sample of the code used is:

strFile = GetFile(id)
strType= LCase(Right(strFileName, Len(strFileName) - InStr(strFileName, ".", CompareMethod.Text)))
If strType= "doc" Then
Response.ContentType = "application/ms-word"
ElseIf strType= "jpg" Or strType= "jpeg" Or strType= "bmp" Then
Response.ContentType = "image/JPEG"
Else
Response.ContentType = "text/plain"
End If
Response.AddHeader("content-disposition", "inline;filename=" & strFileName)
Response.BinaryWrite(myReader.Item("binData"))

The problem is that on some machines, the doc opens up as the .aspx file itself, on other machines it opens the word document. (Word is installed on all machines, and other web pages that have attachments have no such problems).

The jpeg files ALWAYS open up ok.
 
Back
Top