D
dany
Wrote a script (tried to which should force to download a pdf-file, but it
doesn't work on every browser.
What should be changed ?
SCRIPT:
---------
<%
Dim Stream
Dim Contents
Dim strFileName
Dim strFilePath
strFileName = "download.pdf"
strFilePath = Server.MapPath(strFileName)
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename=" &
strFileName
Set Stream = server.CreateObject("ADODB.Stream")
Stream.Open
Stream.LoadFromFile strFilePath
Contents = Stream.ReadText
Response.BinaryWrite Contents
Stream.Close
Set Stream = Nothing
%>
TESTED ON:
--------------
PC:
IE6+: ok
OPERA7+: ok
NS7+: gives a saveas-popup but adds ".asp" to the file "download.pdf" =>
download.pdf.asp
MOZ1.2+: same as NS7
OPERA6+: don't work, displays a lot off sh*beep*t
MAC
SAFARI: ok
IE5.2: gives popup but pdf can't be opened due to decoding-error?
doesn't work on every browser.
What should be changed ?
SCRIPT:
---------
<%
Dim Stream
Dim Contents
Dim strFileName
Dim strFilePath
strFileName = "download.pdf"
strFilePath = Server.MapPath(strFileName)
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename=" &
strFileName
Set Stream = server.CreateObject("ADODB.Stream")
Stream.Open
Stream.LoadFromFile strFilePath
Contents = Stream.ReadText
Response.BinaryWrite Contents
Stream.Close
Set Stream = Nothing
%>
TESTED ON:
--------------
PC:
IE6+: ok
OPERA7+: ok
NS7+: gives a saveas-popup but adds ".asp" to the file "download.pdf" =>
download.pdf.asp
MOZ1.2+: same as NS7
OPERA6+: don't work, displays a lot off sh*beep*t
MAC
SAFARI: ok
IE5.2: gives popup but pdf can't be opened due to decoding-error?