Your problem is indeed the disposition, it needs to be:
Response.AddHeader "content-disposition","attachment; filename=" &
Trim(rs.Fields.Item("sFileName").Value)

I'd also recommend assigning all of your recordset items to variables and
then closing the recordset *before* BinaryWriting your file, you'll get the
recordset out of scope before anything has a chance to go wrong.

Wade

on 10/9/02 6:36 AM, Rupert Killick at [EMAIL PROTECTED] wrote:

> Hi
> 
> I'm trying to set the content type of a page to application/pdf, to prompt
> to download or save of a pdf file coming direct from a database.
> The page is accessed via a link, but rather than prompting to view or save
> the file, simply outputs the binary code in the browser.
> Code is as follows (I have left out the recordset query)
> 
> Response.ContentType = "application/pdf"
> Response.AddHeader "Content-Type", "application/pdf"
> Response.AddHeader "Content-disposition","filename" &
> Trim(rs("sFileName"))
> Response.AddHeader "Content-Length", rs("sFileSize")
> Response.BinaryWrite(rs("binFile"))
> 
> I've tried various other things, like spelling 'disposition' with a 'D',
> entering a hard-coded file name etc.
> 
> Any advice would be appreciated.


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to