📄 upfile.asp
字号:
<%
'==============================================================================
'软件名称:星空社区 VER 1.0测试版
'当前版本:starcity club V1.0.15
'最新更新:2004.9
'==============================================================================
'Copyright (C) 2002-2004 Googln.com All rights reserved.
'商业注册联系:010-64410364
'技术支持QQ:6370639(?????)
'程序开发:Googln Studio(BeiJing)
'Email:Avram@163.com
'论坛支持:星空社区(http://www.starcity.cn/bbs)
'官方网站:www.Googln.com 演示站点:www.starcity.cn/bbs 都市星空:www.starcity.cn 阳光商城:www.sunmall.com.cn
'==============================================================================
'免费版本请在首页保留版权信息,并做上本站LOGO友情连接
'都市星空在线保留此程序的法律追究权利
'==============================================================================
%>
<%OPTION EXPLICIT%>
<%Server.ScriptTimeOut=5000%>
<!--#include FILE="upload.inc"-->
<html>
<head>
<title>文件上传</title>
</head>
<link rel="stylesheet" type="text/css" href="include/style_.css">
<body>
<%
dim upload,file,formName,formPath,iCount
set upload=new upload_5xsoft ''建立上传对象
for each formName in upload.objFile ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
dim fileExt,ranNum,filename
fileExt=lcase(right(file.filename,4))
randomize
ranNum=int(90000*rnd)+10000
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&fileExt
if file.filesize<100 then%>
<script language=javascript>
alert("请先选择你要上传的文件!");
location.href='upload.asp';
</script><%
end if
if file.filesize>512*1024 then
%><script language=javascript>
alert("文件大小超过了限制512 K!");
location.href='upload.asp';
</script><%
end if
dim uploadsuc,Forumupload,i
i=0
uploadsuc=false
Forumupload=split("gif,jpg,png,zip,rar,doc,xls",",")
for i=0 to ubound(Forumupload)
if fileEXT="."&trim(Forumupload(i)) then
uploadsuc=true
exit for
else
uploadsuc=false
end if
next
if uploadsuc=false then%>
<script language=javascript>
alert("文件格式不正确!");
location.href='upload.asp';
</script>
<%end if
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath("upImages/"&FileName) ''保存文件
end if
set file=nothing
next
set upload=nothing ''删除此对象
if fileext=".swf" then
response.write "<script>parent.form.content.value+='[flash]"&"upImages/"&FileName&"[/flash]'</script>"
else
response.write "<script>parent.form.content.value+='[img]"&"upImages/"&FileName&"[/img]'</script>"
end if
response.write"<Script Language=Javascript>location.href='upload.asp';</Script>"
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -