[thelist] Download Files from Database (ASP)

Anthony Johnston . Antix tech at antix.co.uk
Thu Feb 20 11:01:06 CST 2003

add this before response.contentType

response.addHeader "content-disposition","inline;filename=" & rs("fileName")


>-----Original Message-----
>From: thelist-admin at lists.evolt.org
>[mailto:thelist-admin at lists.evolt.org]On Behalf Of Feingold Josh S
>Sent: 20 February 2003 16:54
>To: thelist at lists.evolt.org
>Subject: [thelist] Download Files from Database (ASP)
>[ Picked text/plain from multipart/alternative ]
>I am trying to download a file using ASP from SQL server.  My basic setup is
>that a visitor clicks a link which references the unique id of the file in
>the database.  Something like this:
><a href="download.asp?id=341">A Tribute to PowerPoint</a>
>Download.asp consists of:
>	set conn = server.createobject("adodb.connection")
>	set rs = server.createobject("adodb.recordset")
>	rs.Open "SELECT * FROM cctProjectFiles WHERE id=" &
>	Response.ContentType =  rs("contentType")
>	Response.BinaryWrite rs("picdata")
>	Response.End
>The file downloads fine and everything, but the problem that I am having is
>that the file downloads as download.asp so when the user tries to save the
>file they are prompted to save a file called "download.asp?id=341.doc".  I
>would like them to automatically be prompted for the name of the file (A
>Tribute to PowerPoint), which is also stored in the database record
>and can be referenced with rs("fileName").
>Any suggestions?
>* * Please support the community that supports you.  * *
>For unsubscribe and other options, including the Tip Harvester
>and archives of thelist go to: http://lists.evolt.org
>Workers of the Web, evolt !

More information about the thelist mailing list