'Download an object
Function downloadfile (fullpath)
Downloadfile = false
Dim strfilename, S, FSO, F, intfilelength
Set FSO = server. Createobject ("scripting. FileSystemObject ")
If not FSO. fileexists (fullpath) then
Exit Function
End if
Set F = FSO. GetFile (fullpath)
'Get File Size
Intfilelength = f. Size
Set S = server. Createobject ("ADODB. Stream ")
S. Open
S. type = 1
S. loadfromfile (fullpath)
Response. Buffer = true
Response. Clear
'Response. addheader "content-encoding", "gb2312" 'garbled Solution
'Response. addheader "Content-Type", "application/X-msdownload"
Response. addheader "content-disposition", "attachment; filename =" & F. Name
Response. addheader "Content-Length", intfilelength
Response. contenttype = "application/octet-stream"
While not S. Eos
Response. binarywrite S. Read (1024*64)
Response. Flush
Wend
S. Close
Set S = nothing
Downloadfile = true
End Function