Hi there
I am in the process of building a small "Content Management System" where users will beable to Upload files, (mainly PDF's) to an access database on my website. The users will also beable to search for files and then DOWNLOAD their selected file from the database. Ive got the upload and search pages build, but can't seem to figure out the download bit.
The search page displays the Files in a table, with a link to the file in one of the columns.
Ive used the following piece of code to make the link:
<A href="download.asp?FileName=<%= rstSearch.Fields("FileName"
.Value %>"><%= rstSearch.Fields("FileName"
.Value %></a>
The page download.asp contains the following code:
<%
Dim oConn
Dim oRs
Dim sSQL
Dim cnnSearch
Dim rstSearch
set oConn = server.createobject("adodb.connection"
set oRs = server.createobject("adodb.recordset"
oConn.Open = ("DSN=seibDSN"
sSQL = "SELECT * FROM Files WHERE FileName = " & Request.QueryString("FileName"
Filename = ""
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; FileName = " & FileName
Response.AddHeader "Document", FileName
Response.AddHeader "Script_Name", FileName
Response.Write Head
content = StatsRS.GetString(,,",",vbcrlf,""
response.write content
Response.Flush
Response.End
%>
All this, but the files will not download. Can anyone help?
Thanks
I am in the process of building a small "Content Management System" where users will beable to Upload files, (mainly PDF's) to an access database on my website. The users will also beable to search for files and then DOWNLOAD their selected file from the database. Ive got the upload and search pages build, but can't seem to figure out the download bit.
The search page displays the Files in a table, with a link to the file in one of the columns.
Ive used the following piece of code to make the link:
<A href="download.asp?FileName=<%= rstSearch.Fields("FileName"


The page download.asp contains the following code:
<%
Dim oConn
Dim oRs
Dim sSQL
Dim cnnSearch
Dim rstSearch
set oConn = server.createobject("adodb.connection"

set oRs = server.createobject("adodb.recordset"

oConn.Open = ("DSN=seibDSN"

sSQL = "SELECT * FROM Files WHERE FileName = " & Request.QueryString("FileName"

Filename = ""
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; FileName = " & FileName
Response.AddHeader "Document", FileName
Response.AddHeader "Script_Name", FileName
Response.Write Head
content = StatsRS.GetString(,,",",vbcrlf,""

response.write content
Response.Flush
Response.End
%>
All this, but the files will not download. Can anyone help?
Thanks