📄 file_down.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="chkuser.asp"-->
<!--#include file="inc/user.asp"-->
<%
path=Request("path")
If path = "" or Instr(path,"..")>0 then
WriteErrMsg("处理URL时出错,请与系统管理员联系!")
Response.end
End if
checkpath="/"&Request.Cookies("9cool_username")
if lcase(checkpath)<>lcase(left(path,len("/"&Request.Cookies("9cool_username")))) then
WriteErrMsg("处理URL时出错,请与系统管理员联系!")
response.end
end if
call downloadFile(path)
function downloadFile(strFile)
strFilename = userdir&strFile
Response.Buffer = True
Response.Clear
Set s = Server.CreateObject("ADODB.Stream")
s.Open
s.Type = 1
on error resume next
if not fso.FileExists(strFilename) then
Response.Write("<h1>Error:</h1>" & strFilename & " does not exist<p>")
Response.End
end if
Set f = fso.GetFile(strFilename)
intFilelength = f.size
s.LoadFromFile(strFilename)
if err then
Response.Write("<h1>Error: </h1>" & err.Description & "<p>")
Response.End
end if
Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name
Response.AddHeader "Content-Length", intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite s.Read
Response.Flush
s.Close
Set s = Nothing
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -