⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upfile.asp

📁 多用户个人主页系统(ASP)
💻 ASP
字号:
<%
response.buffer=true
response.expires=0%>
<!--#include file="includes/setup.asp"-->
<!--#include FILE="upload.inc"-->
<!--#include FILE="includes/upfilesetup.asp"-->
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="images/left.css" rel="stylesheet" type="text/css">
<body bgcolor="#FFCC00">
<%
dim id,username
id=request("num")
username=request("username")
if session("xichen_username")<>username then
%>
<script>alert('您的操作非法,已被系统记录!');location.href='javascript:self.close()'</script>
<%
end if

dim upload,file,formName,formPath,iCount,Pppath,sp
set upload=new upload_5xsoft ''建立上传对象
Pppath="home"

if upload.form("filepath")="" then   ''得到上传目录
 HtmEnd "请输入要上传至的目录!"
 set upload=nothing
 response.end
else
 formPath=upload.form("filepath")
 sp=formPath
 ''在目录后加(/)
 if right(formPath,1)<>"\" then formPath=formPath&"\" 
end if

Set kjs= fs.GetFolder(fullpath&HPDIRName&"\"&username)
select case session("xichen_usergroup")
case "1"
kj=10000000
case "2"
kj=20000000
case "3"
kj=40000000
case "4"
kj=80000000
case "5"
kj=100000000
end select

allsize=kj/1000000
usesize=kjs.size/1000000
nowmaxsize=allsize-usesize

iCount=0

for each formName in upload.objFile ''列出所有上传了的文件
 set file=upload.file(formName)  ''生成一个文件对象
 
 if Instr(FileType,GetExtendName(file.FileName)) then
 else
	HtmEnd "对不起,不允许上传该类型文件!"
	set upload=nothing
	response.end
 end if
if file.filesize=0 then
 	HtmEnd "您还没有选择要上传的文件!"
	set upload=nothing
	response.end
 end if
 if file.filesize>cint(uploadsize)*1024 then
 	HtmEnd "对不起,单个文件不允许超过2M大小!"
	set upload=nothing
	response.end
 end if
  if file.filesize>nowmaxsize*1024*1024 then
 	response.write "<script>alert('对不起,您的空间容量已不足!\n\n您需要删除一些文件或者升级空间!');location.href='javascript:history.back()'</script>"
	set upload=nothing
	response.end
 end if

 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  file.SaveAs Server.mappath(Pppath&formPath&file.FileName)   ''保存文件
  iCount=iCount+1
 end if

 	

 set file=nothing
next
set upload=nothing  ''删除此对象

function GetExtendName(FileName)
dim ExtName
ExtName = LCase(FileName)
ExtName = right(ExtName,4)
ExtName = right(ExtName,4-Instr(ExtName,"."))
GetExtendName = ExtName
end function
%>
<input name="dd" value="<%=sp%>" type=hidden>
<script language="jscript" type="text/JavaScript">
	alert("<%=iCount%>个文件上传成功!");
	purl="main.asp?num=<%=id%>&username=<%=username%>&path="+document.all.dd.value;
	window.open(purl,"_self");
</script>
<%

sub HtmEnd(Msg)
 set upload=nothing
 response.write "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'>"
 response.write "<tr>"
 response.write "<td align='center'><p>"&Msg&"</p><input type=submit name=Submit class=input1 value=' 返回 '  onClick=javascript:history.back()></td>"
 response.write "</tr>"
 response.write "</table>"
 response.end
end sub
%>
</body>
</html>

⌨️ 快捷键说明

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