upfile.asp

来自「一套比较完整的内部技术支持全部源代码,请大家共同分享」· ASP 代码 · 共 55 行

ASP
55
字号
<%response.expires=0%>
<!--#include FILE="inc/upload.asp"-->
<%
if session("currentpath")="" or session("yyj_name")="" then
   response.redirect "exit.asp"
end if
path=session("currentpath")
Set fs = Server.CreateObject("Scripting.FileSystemObject")
	useBytes = fs.GetFolder(path).Size
dim maxsize
maxsize=1000000*500
if useBytes>maxsize then
   response.redirect "error.asp?id=1"
else
   maxsize=maxsize-useBytes
end if
%>
<%
dim upload,file,formName,formPath,iCount,filename,fileExt
set upload=new upload_5xSoft ''建立上传对象

iCount=0
for each formName in upload.file ''列出所有上传了的文件
 set file=upload.file(formName)  ''生成一个文件对象

 filename=session("currentpath") & session("zipath") & "\" & file.FileName

 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  file.SaveAs filename   ''保存文件
  'response.write file.FilePath&file.FileName&" ("&file.FileSize&") => "&formPath&File.FileName&" 成功!<br>"
   iCount=iCount+1
 end if
 set file=nothing
next
set upload=nothing  ''删除此对象

response.write iCount&" 个文件上传结束!"

%>
<%
'Set objUP=Server.CreateObject("aspcn.Upload")
'	objUP.Maxsize=maxsize
'	objUP.Path=session("currentpath")&session("zipath")
'	objUP.Upload
'	objUP.SaveAll
'	Set objUP=Nothing
dim str
str=server.urlencode(session("zipath"))
%>
<script language=javascript>
alert("<%=icount%>个文件上传成功!");
parent.list.location.href="list.asp?url=<%=str%>";
history.go(-1);
</script>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?