daveigh
Programmer
- Oct 9, 2003
- 105
hi guys, m having problems with my code here. this one is supposed to pass an id querystring which i use to search the path of the file to download on my access database. it was able to get the path the zipped file is saved, but whenever i try to click on the link, it either adds a .asp extension filename on the zip file, or it opens the zip file in a browser, wherein i see lots of garbled text. m very much sure i added a content header, as you can see on my code below.
***************************************************************
tid = request("tid")
set rs = server.createobject("ADODB.Recordset")
sql = "SELECT uid,dirpath FROM template WHERE uid = "& tid &";"
'response.write sql
'response.end
rs.Open sql, oConn, adOpenStatic
filepath = rs("dirpath")
if not rs.eof then
Set upl = Server.CreateObject("SoftArtisans.FileUp")
Set fm = Server.CreateObject("SoftArtisans.FileManager")
'ToDo: Change filename to point to something you would like to download
filename = Replace(filepath, "templates/", "")
set file = fm.GetFile(Server.MapPath(filepath))
file_Name = file.Name
file_Size = file.Size
Response.AddHeader "Content-Disposition", "attachment;filename=""" & file_Name & """"
Response.AddHeader "Content-Length", file_Size
Response.ContentType = "application/zip"
upl.TransferFile(Server.MapPath(filepath))
set upl = nothing
else
response.write "The file you wish to download does not exist. Please contact our Tech Support for any inquiries."
end if
_______________CRYOcoustic_____________
***************************************************************
tid = request("tid")
set rs = server.createobject("ADODB.Recordset")
sql = "SELECT uid,dirpath FROM template WHERE uid = "& tid &";"
'response.write sql
'response.end
rs.Open sql, oConn, adOpenStatic
filepath = rs("dirpath")
if not rs.eof then
Set upl = Server.CreateObject("SoftArtisans.FileUp")
Set fm = Server.CreateObject("SoftArtisans.FileManager")
'ToDo: Change filename to point to something you would like to download
filename = Replace(filepath, "templates/", "")
set file = fm.GetFile(Server.MapPath(filepath))
file_Name = file.Name
file_Size = file.Size
Response.AddHeader "Content-Disposition", "attachment;filename=""" & file_Name & """"
Response.AddHeader "Content-Length", file_Size
Response.ContentType = "application/zip"
upl.TransferFile(Server.MapPath(filepath))
set upl = nothing
else
response.write "The file you wish to download does not exist. Please contact our Tech Support for any inquiries."
end if
_______________CRYOcoustic_____________