www.gusucode.com > 化境ASP文件管理系统 1.1源码程序 > upload.asp

    <%OPTION EXPLICIT%>
<%
if Session("webeditbase")="" or Session("webeditrun")="" then response.redirect "login.asp"
dim isSetVar
isSetVar=0
Server.ScriptTimeOut=5000
%>
<!--#include FILE="include.asp"-->
<!--#include FILE="upload_5xsoft.inc"-->
<html>
<head>
<title>文件上传</title>
</head>
<body>
<%
dim upload,file,formName,formPath,iCount,act,iFail
set upload=new upload_5xSoft

response.write "<br><br>"&upload.Version&"<hr size=1 noshadow width=300 align=left><br><font size=2>"

if upload.form("filepath")="" then
 HtmEnd "请输入要上传至的目录!",1,""
 set upload=nothing
 response.end
else
 formPath=upload.form("filepath")
 ''在目录后加(/)
 if right(formPath,1)<>"/" then formPath=formPath&"/"
 act=procCheckDir(formpath,1)
 if act<>"ok" then htmEnd "错误! "&act,1,""
end if

iCount=0
iFail=0
for each formName in upload.objFile
 set file=upload.file(formName)
 if file.FileSize>0 then
  act=procCheckFile(file.FileName,0)
  response.write "<br>"&file.FilePath&file.FileName&",大小:"&file.FileSize&" => "&formPath&File.FileName
  if act="ok" then
   file.SaveAs Server.mappath(formPath&file.FileName)
   response.write " <font color=#0000ff>成功!</font>"
   iCount=iCount+1
  else
   response.write " <font color=#ff0000>失败! "&act&"</font>"
   iFail=iFail+1
  end if
 end if
 set file=nothing
next
set upload=nothing  ''删除此对象
response.write "<br><br><hr size=1 noshadow width=300 align=left>"&iCount&" 个文件上传成功! "&iFail&"个文件上传失败</font>"
%><br><br>
<input type=button value=返回 onClick="location.href='upfile.asp';">
<input type=button value=关闭 onClick="window.close();">
<script language=javascript>
if(window.opener&&window.opener.refreshit)
 window.opener.refreshit();
</script>
<%htmEnd "",0,""%>
</body>
</html>