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

📄 upfile.asp

📁 一个美化的论坛程序
💻 ASP
字号:
<!--#include FILE="conn.asp"-->
<!--#include FILE="const.asp"-->
<!--#include FILE="upload.inc"-->
<html>
<head>
<title>文件上传</title>
</head>
<body bgcolor="<%=tablebodycolor%>" leftmargin="2" topmargin="7">
<%
if Request.Cookies("bookbaby")("username")="" then
	response.write "<font size=2 color=#ff0000>只有注册用户才能上传图片</font>"
	response.end
end if
dim upload,file,formName,formPath,iCount,filename,fileext
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.file ''列出所有上传了的文件
 set file=upload.file(formName)  ''生成一个文件对象
 fileExt=lcase(right(file.filename,4))
 if fileEXT<>".gif" and fileEXT<>".jpg" and fileEXT<>".bmp" then
 	response.write "<font size=2>文件格式不对 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
	response.end
 end if 
if file.filesize>100000 then
 	response.write "<font size=2>图片大小超过了限制 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
	response.end
end if
 filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&right(file.FileName,4)
 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  file.SaveAs Server.mappath(filename)   ''保存文件
  response.write "<script>parent.document.forms[0].content.value+='[img]"&filename&"[/img]'</script>"
  iCount=iCount+1
 end if
 set file=nothing
next
set upload=nothing  ''删除此对象
Htmend iCount&" 个文件上传结束!"

sub HtmEnd(Msg)
 set upload=nothing
 response.write "<font size=2 color=#ff0000>图片上传成功,请copy下边的图片连接,以备后用 [<a href=javascript:history.go(-1)>继续上传</a>]</font>"
 response.end
end sub
%>
</body>
</html>

⌨️ 快捷键说明

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