[thelist] Download Files from Database (ASP)

Feingold Josh S Josh.S.Feingold at irs.gov
Thu Feb 20 10:54:19 CST 2003


--
[ 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=" &
Request.QueryString("id"),conn
	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?

Thanks,
Josh



More information about the thelist mailing list