IE7 force PDF download (1 Viewer)

danb

Registered User.
Local time
Today, 07:24
Joined
Sep 13, 2003
Messages
98
Hi,

The following code works in Firefox, but in IE7 it just spits out a screen full of weird characters:

Code:
<% 
    Response.ContentType = "application/pdf"
    FPath = server.mappath("pdf/portfolio.pdf") 
    Response.AddHeader "Content-Disposition","attachment; filename=" & FPath
    Set adoStream = CreateObject("ADODB.Stream") 
    adoStream.Open() 
    adoStream.Type = 1 
    adoStream.LoadFromFile(FPath) 
    Response.BinaryWrite adoStream.Read() 
    adoStream.Close 
    Set adoStream = Nothing 
    Response.End 
%>

What I need to do basically is force the PDF file to be downloaded rather than opened in a new browser window (something like the links on this page: http://www.worcester-bosch.co.uk/index.php?fuseaction=literature.detail&con_id=125929&from_id=5029 - which prove it can be done [albeit with PHP]). It's proving incredibly difficult to get this to work cross-browser!

Any ideas anyone!?
 

Users who are viewing this thread

Top Bottom