<% Server.ScriptTimeOut = 1800 dim constPath,mypath mypath=server.mappath("WAP2_Upfilexx.asp") constPath=replace(mypath,"WAP2_Upfilexx.asp","") dim TP TP=request.querystring("TP") dim upload,oFile,formName,SavePath,filename,fileExt,oFileSize,sizes dim EnableUpload dim arrUpFileType dim ranNum dim msg,FoundErr,MaxFileSize MaxFileSize="102400"'最大上传文件,以KB为单位 msg="" FoundErr=false EnableUpload=true dim strMonth,strDay dim kk,reshow,pwidth,pheight,up dim userid,username,sessionid,photoContent,photoview kk=0 set upload=new upfile_class ''建立上传对象 upload.GetData(104857000600) '取得上传数据,限制最大上传100M if upload.err > 0 then '如果出错 select case upload.err case 1 msg= "请先选择你要上传的文件!" case 2 msg= "你上传的文件总大小超出了最大限制(100M)" end select 'showWML() response.end end if SavePath = "win/" xuanname=trim(upload.form("xuanname")) if xuanname="" then Call Error("名称不能为空,请返回重试!") end if if len(xuanname)>10 then Call Error("名称最多10字,请返回重试!") end if for each formName in upload.file set ofile=upload.file(formName) '生成一个文件对象 upfilename=ofile.FileName oFileSize=ofile.filesize sizes=cstr(round(oFileSize/1024)) fileExt=lcase(ofile.FileExt) if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" or fileEXT="exe" or fileEXT="bat" or fileEXT="dll" then EnableUpload=false end if if EnableUpload=false then msg="这种文件类型不允许上传:asp|asa|aspx|exe|bat|..." FoundErr=true 'showWML() response.end end if if fileExt="gif" or fileExt="jpg" or fileExt="jpeg" or fileExt="png" then else Call Error("图片格式错误!") end if if oFileSize>(MaxFileSize*1024) then msg="文件大小超过了限制,最大只能上传" & CStr(MaxFileSize) & "K的文件!" FoundErr=true 'showWML() response.end end if if FoundErr<>true then randomize ranNum=int(900*rnd)+100 strMonth=month(now) if len(strMonth)=1 then strMonth="0"&strMonth end if strDay=day(now) if len(strDay)=1 then strDay="0"&strDay end if '-------------------- filename=SavePath&year(now)&strMonth&strDay&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt 'response.write getRealPath(FileName) dim realpath realpath="/bbs/images/"&filename 'realpath=getRealPath(filename) ' response.write realpath '建立文件夹 'setCreateFolder(realpath) ofile.SaveToFile Server.mappath(""&realpath&"") '保存文件 if upfilename<>"" then '将文件写入数据库 dim intsql,tempcontent intsql= "insert into xuanz(name,tou)values" intsql= intsql & "('" & xuanname& "','" & realpath & "')" conn.execute(intsql) END IF END IF set file=nothing next set upload=nothing msg="您的勋章已成功上传!
" conn.close set conn=nothing %> <%=msg%> [勋章管理]