用asp实现文件浏览、上传、下载的程序(6)
Set fl=fso.getfile(url)
flsize=fl.size
flName=fl.name
Set fl=Nothing
Set fso=Nothing
Set objStream=Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type=1
objStream.LoadFromFile url
ContentType="text/html"
Response.AddHeader "Content-Disposition","attachment;filename="&flName
Response.AddHeader "Content-Length", flsize
Response.Charset = "UTF-8"
Response.ContentType = ContentType
Response.BinaryWrite objStream.Read
Response.Flush
response.Clear()
objStream.Close
Set objStream = Nothing
end function
function uploadfiles()
filepath=foldinfo
set upload=new clsUp
upload.NoAllowExt="aep"
upload.GetData (3072000)
if upload.form("act")="uploadfile" then
for each formName in upload.File
set file=upload.File(formName)
randomize
filename1=file.FileName
filename=filepath&filename1
if file.FileSize>0 then
upload.SaveToFile formName,FileName
end if
set file=nothing
next
set upload=nothing
end if
end function
action = request("action")
if action = "deletefile" then
filename = request("filename")
deletefile(filename)
end if
if action = "deletedir" then
deletedirname = request("deletedir")
deletedir(deletedirname)
end if
if action = "download" then
filename = request("filename")
download(filename)
end if
if action = "uploadfiles" then
uploadfiles()
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<table>
<tr>
<td><font>当前目录:</font><font color="#FF7120"><%=foldinfo%></font>
内容版权声明:除非注明,否则皆为本站原创文章。