Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adds asp extension whenever i download a zip file

Status
Not open for further replies.

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_____________
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top