Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: ADOStream and PDF File problem
07-22-2004, 05:24 PM #1
- Join Date
- Jan 2003
- Thanked 0 Times in 0 Posts
ADOStream and PDF File problem
We are using the following code to download PDF files and save them on the users computer:
' fn is the file name of the file to download.
fn = Request.QueryString("FN")
Response.ContentType = "application/x-unknown" ' arbitrary
' FPath is the directory containing the file, could not be passed with file name.
FPath = "D:\wwwroot\cbai\RCBImage\images\" & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn
Set adoStream = CreateObject("ADODB.Stream")
adoStream.Type = 1
Set adoStream = Nothing
When the user clicks on the download option from the previous screen that passes the file nume to this code, they get the windows dialog to save of view the file. This works fine as long as they save the file. But if they ever view the file, it will always go to viewing the file automatically and generate an error stating the PDF file has a bad header. The user must close their browser and reopen it, then enter the site all over again to download more files.
Can anyone give us info so we can always force the save/view/open dialog. It seems that once a document is viewed, it always defaults to the program used to view it previously within that browser session.