28,391
社区成员
发帖
与我相关
我的任务
分享
<%
set upload=new UpFile_Class '建立上传对象
upload.NoAllowExt="asp;asa;cer;aspx;cs;vb;js;exe;" '设置上传类型的黑名单
upload.GetData (2048000) '取得上传数据,限制最大上传6M
'upath=request.Form("upath")
upath=upload.form("upath")
'uupath=Whereform&"/upsp"&upath
filepath="../upsp/"&upath&"/" '上传路径
filepathname = "upsp/"&upath&"/"
if upload.form("act")="uploadfile" then
for each formName in upload.File
set file=upload.File(formName)
fileExt=lcase(file.FileExt) '得到的文件扩展名不含有.
if file.filesize<10 then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">请先选择你要上传的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
if file.filesize>(2000*1024) then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 2M 的视频文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
if fileExt<>"rmvb" and fileExt<>"swf" then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传rmvb或SWF格式的视频! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
dtNow=Now()
randomize
ranNum=int(90000*rnd)+10000
filename1=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum &"."&fileExt
filename=filepath&filename1
filelstname=filepathname&filename1
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
upload.SaveToFile formName,Server.mappath(FileName)
'这里可以存数据库
response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&filelstname&"'</script>"
%>
<script language="javascript">
window.alert("上传成功,不要修改地址");
window.close();
</script>
<%
end if
set file=nothing
next
set upload=nothing
end if
%>