<%
'****************************************
'作者:zhengbi
'主页:http://www.glzy8.com/ok3w/
'QQ:124895502
'****************************************
Private Sub FileDownLoad(fname)
pathtype = "application/x-msdownload"
fname = server.MapPath(fname)
filename=split(fname,"\")
set objAdoStream=Server.createObject("ADODB.Stream")
objAdoStream.Type=1
objAdoStream.open()
objAdoStream.LoadFromFile(fname)
strchar=objAdoStream.Read()
fsize=objAdoStream.size
objAdoStream.Close()
set objAdoStream=nothing
Response.AddHeader "content-type", pathtype
Response..AddHeader "Content-Disposition","attachment;filename=" & filename(ubound(filename))
Response.AddHeader "content-length", fsize
Response.BinaryWrite(strchar)
Response.Flush()
End sub
%>
<%
'=======调用示例=========
Call FileDownLoad("test.jpg")
%>