View Full Version : Forcing download dialog box problem

03-15-2007, 05:05 PM
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.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

03-15-2007, 06:00 PM
can you find anything useful in this (http://www.codingforums.com/showthread.php?t=70889) thread?

03-16-2007, 08:25 AM
can you find anything useful in this (http://www.codingforums.com/showthread.php?t=70889) thread?
Good thread