#122002/8/2 18:21:12
放出全部代码,偶看不懂所以不知道有没有用
<%
'Response.Expires=0
fpath = Request("filepath")
fname = Request("filename")
unitenum=request("unitenum")
tblname=request("tblname")
if cstr(tblname)<>"" and cstr(unitenum)<>"" then
conn.execute "update "&tblname&" set downtimes=downtimes+1 where unitenum='"&unitenum&"'"
conn.close
end if
' on error resume next
Response.Buffer = True
Response.Clear
ext = Lcase(mid(fpath,InstrRev(fpath,".",-1,1)+1))
set fso=CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(server.mappath(fpath)) then
Response.addheader "content-type","application/octet-stream;charset=gb2312;"
Response.addheader "content-disposition","attachment;filename="&trim(fname& "." & ext)
Set f = fso.GetFile(Server.Mappath(fpath))
Set ts=f.openastextstream(1,-1)
Response.binaryWrite ts.read(f.size/2)
Response.End
else
Set s = Server.CreateObject("ADODB.Stream")
s.Open
s.Type = 1
Set f = fso.GetFile(server.mappath(fpath))
intFilelength = f.size
s.LoadFromFile(server.mappath(fpath))
call Response.AddHeader("Content-Disposition","attachment;filename="&trim(fname& "." & ext))
Response.AddHeader "Content-Length", intFilelength
Response.addheader "content-type","application/octet-stream"
Response.CharSet = "UTF-8"
Response.BinaryWrite s.Read
Response.Flush
s.close
set s=nothing
set fso=nothing
set f=nothing
end if
%>