www.gusucode.com > 漂亮的地方旅游景点景观介绍网站源代码 > admin/upload.asp
<!--#include file="config.asp" --> <!--#include file="../inc/UpLoadClass.asp" --> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <% call zwtj() Server.ScriptTimeOut=5000 function CanUpload(Fileurl) dim i,str if atype="" then call cc("您还为设置["&lxmc&"]类型的可上传文件类型") end if canupload=false str=split(atype,"|") for i=0 to ubound(str) if trim(lcase(str(i)))=trim(lcase(fileurl)) then canupload=true end if next end function dim lx,up,savepath,path1,tab,f1,f2,f3,bj lx=Trim(Request.QueryString("lx")) up=Trim(Request.QueryString("up")) tab=Trim(Request.QueryString("tab")) f1=Trim(Request.QueryString("f1")) f2=Trim(Request.QueryString("f2")) f3=Trim(Request.QueryString("f3")) id=Trim(Request.QueryString("id")) bj=Trim(Request.QueryString("bj")) if bj="" then bj=0 end if if up="" then up=0 end if dim path,lxmc,atype,asize select case lx case 1 '图片 path="/uploadfile/bimg/" path1="/uploadfile/simg/" lxmc="图片" atype=pictype asize=picsize case 2 '媒体文件 path="/uploadfile/media/" lxmc="媒体文件" atype=mediatype asize=mediasize case 3 '压缩文件 path="/uploadfile/zip/" lxmc="压缩文件" atype=ziptype asize=zipsize case 4 '文档 path="/uploadfile/text/" lxmc="文档文件" atype=texttype asize=textsize case 5 '其他文件 path="/uploadfile/other/" lxmc="其他文件" atype=othertype asize=othersize case 6 path="/uploadfile/" lxmc="不限类型" atype=othertype&"|"&pictype&"|"&mediatype&"|"&ziptype&"|"&txttype end select savepath=path dim savepath1,spath1 savepath1=savepath spath1=path1 cacfol(savepath1) if path1<>"" then cacfol(spath1) end if dim uploadtype uploadtype=replace(atype,"|","/") '上传///////////////////////////////////////////////////////////////////////////// if uploadapi=0 then call fsup(asize,savepath,uploadtype,"file") else call aspupload(savepath) end if '收尾//////////////////////////////////////////////////////////////////////////////// sub hx(filename,fileid) dim filepath,ext,filesize,dpic '取出数据------------------------------------------------------- set rs=conn.execute("select * from Jw_upfile where id="&fileid) filepath=rs("path") ext=lcase(rs("ext")) filesize=rs("filesize") call recordend(rs) '/类型不匹配 if not canupload(ext) then call delfile(filepath) call cc("对不起!该文件类型不允许上传") end if if up=1 and id<>"" then if f1<>"" and tab<>"" then dpic=getmc(tab,"id",id,f1) call delfile(dpic) end if if f2<>"" and tab<>"" then dpic=getmc(tab,"id",id,f2) call delfile(dpic) end if end if if lx=1 then '生成缩略图-------------------------------------------- if scpic=0 then call getslt(filepath,path1&filename) end if '加水印------------------------------------------------ if tjsy=0 then if sylx=0 then call picsy(filepath) else call textsy(filepath) end if end if '赋值---------------------------------------------------------- Response.Write("<script language=""javascript"">opener.GE("""&f1&""").value="""&filepath&""";") if f2<>"" then if scpic=0 then Response.Write("opener.GE("""&f2&""").value="""&path1&filename&""";") else Response.Write("opener.GE("""&f2&""").value="""&filepath&""";") end if end if if f3<>"" then Response.Write("opener.GE("""&f3&""").value="""&formatnumber(getfilesize(pdlj(filepath))/1024/1024,2,-1)&""";") end if if bj=1 then Response.Write("opener.InsertHTML(""<img src='"&filepath&"'>"");") end if Response.Write("</script>") '赋值END--------------------------------------------------------- else '赋值---------------------------------------------------------- Response.Write("<script language=""javascript"">opener.GE("""&f1&""").value="""&filepath&""";") if f3<>"" then Response.Write("opener.GE("""&f3&""").value="""&formatnumber(getfilesize(pdlj(filepath))/1024/1024,2,-1)&""";") end if Response.Write("</script>") '赋值END--------------------------------------------------------- end if end sub call connend() %> <script language="javascript"> closewin(); </script>