Forcing download dialog box problem
Hi guys.
Having some problems in creating a force download asp. I have got the code from a common example on the net, but I just can't get it working right. The download box does pop up with the correct filename (but always shows a .rar icon). But when I download it the file is always 4kb in size and cannot be opened.
Here is my code:
<%
Response.ContentType = "application/unknown"
Response.AddHeader "Content-Disposition","attachment; filename=" & Request("FileName")
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile Server.MapPath("vaggio/") & Request("FileName")
download = objStream.Read
Response.BinaryWrite download
Set objstream = Nothing
%>
and it is called by:
<a href="download.asp?FileName=bottom.jpg">bottom</a>
any help on this would be much appreciated
|