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

📄 upfile.asp

📁 类似于baidu的百度知道
💻 ASP
字号:
<%OPTION EXPLICIT%>
<%Server.ScriptTimeOut=5000%>
<!--#include file="Config.asp"-->
<!--#include FILE="upload.inc"-->
<head>

</head>

<body topmargin="0" leftmargin="0">
<%
if gx=1 then
if session("person")="" then
	response.write"<script>alert('对不起,您未登录!');history.back();</script>"
end if
dim upload,file,formName,formPath,iCount,fname,ffname,zj
set upload=new upload_5xsoft ''建立上传对象
if upload.form("filepath")="" then   ''得到上传目录
 HtmEnd "请输入要上传至的目录!"
 set upload=nothing
 response.end
else
 formPath=upload.form("filepath")
 ''在目录后加(/)
 if right(formPath,1)<>"/" then formPath=formPath&"/" 
end if
iCount=0
for each formName in upload.objForm ''列出所有form数据
next
for each formName in upload.objFile ''列出所有上传了的文件
 set file=upload.file(formName)  ''生成一个文件对象
if file.FileSize>512000 then
response.write"<script>alert('对不起,文件超过500K!');history.back();</script>"
response.end
end if
if right(file.FileName,3)<>"rar" and right(file.FileName,3)<>"zip" and right(file.FileName,3)<>"txt" and right(file.FileName,3)<>"doc" and right(file.FileName,3)<>"xls" then
response.write"<script>alert('对不起,您上传的文件类型不允许!');history.back();</script>"
response.end
end if
 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  file.SaveAs Server.mappath(formPath&file.FileName)   ''保存文件
fname=formPath&File.FileName
ffname=File.FileName
zj=file.FileSize
  iCount=iCount+1
 end if
 set file=nothing
next
set upload=nothing  ''删除此对象
Htmend iCount&""
sub HtmEnd(Msg)
 set upload=nothing
 response.write " 文件上传成功!<script>parent.document.ftiwen.fname.value='"&fname&"';</script><script>parent.document.ftiwen.zj.value='"&zj&"';</script><script>parent.document.ftiwen.ffname.value='"&ffname&"';</script>"
 response.end
end sub
else
Response.Write ("<script>alert('对不起,共享资料功能未启用!');history.back();</script>")
		Response.end
	end if
%>

⌨️ 快捷键说明

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