www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > admin/upfile_flash.asp
<!--#include file="opendb.asp" --> <!--#include file="upload_wj.asp"--> <% Call CheckAdmin() '禁从站外进入 Call DisableOutSite() Dim upload,filepath,filelx,rename,formName Dim fileExt,ranNum,filename,todb_filename,i,upfile,Maxfile,fixname Maxfile=GetCnkConfig("MaxUpfileSize") set upload=new upload_file if upload.form("act")="uploadfile" then filepath=trim(upload.form("filepath")) filelx=trim(upload.form("filelx")) rename=trim(upload.form("rename")) fixname=trim(upload.form("fixname")) i=0 for each formName in upload.File set upfile=upload.File(formName) fileExt=lcase(upfile.FileExt) '得到的文件扩展名不含有. if upfile.filesize<100 then response.write "<span style=""font-family: 宋体; font-size: 9pt"">请先选择你要上传的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>" response.end end if if (filelx<>"swf") and (filelx<>"jpg") and (filelx<>"doc") then response.write "<span style=""font-family: 宋体; font-size: 9pt"">该文件类型不能上传! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>" response.end end if if filelx="swf" then if fileext<>"swf" and (fileext<>"rm") and (fileext<>"ram") and (fileext<>"wmv") and (fileext<>"asf") then response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传swf/rm/ram/wmv/asf文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>" response.end end if end if if filelx="doc" then if fileext<>"doc" and fileext<>"pdf" and fileext<>"zip" and fileext<>"rar" then response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传doc,pdf,zip,rar格式文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>" response.end end if end if if filelx="jpg" then if fileext<>"gif" and fileext<>"jpg" and fileext<>"png" then response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg或gif格式的图片! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>" response.end end if end if if filelx="swf" then if upfile.filesize>(Maxfile*1024) then response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 "&Maxfile&" K 的Flash文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>" response.end end if end if if filelx="jpg" then if upfile.filesize>(Maxfile*1024) then response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 "&Maxfile&" K 的图片文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>" response.end end if end if if rename="" then if fixname<>"" then filename=filepath&fixname&"."&fileExt todb_filename=fixname&"."&fileExt else randomize ranNum=int(90000*rnd)+10000 filename=filepath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt '程序写入的完整的路径及文件名 todb_filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt '写入数据库的文件名 end if else filename=filepath&rename '程序写入的完整的路径及文件名 todb_filename=rename '写入数据库的文件名 end if %> <% if upfile.FileSize>0 then ''如果 FileSize > 0 说明有文件数据 'upfile.SaveAs Server.mappath(filename) ''保存文件 upfile.SaveToFile Server.mappath(FileName) Call ChkHackWord(FileName) 'response.write upfile.FileName&" 上传成功! <br>" 'response.write "新文件名:"&FileName&"<br>" 'response.write "新文件名已复制到所需的位置,可关闭窗口!" if filelx="swf" then response.write "<script>window.opener.document."&upload.form("FormName")&".size.value='"&int(upfile.FileSize/1024)&" K'</script>" end if response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&todb_FileName&"'</script>" %> <% end if set upfile=nothing next set upload=nothing end if %> <script language="javascript"> window.alert("文件上传成功!请不要修改生成的链接地址!"); window.close(); </script> <meta http-equiv="Content-Type" content="text/html; charset=gb2312">