<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><!--#include file="AspCms_Conn.asp"--><!doctype html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">body,form{margin:0px;padding:0px;border:0px;}body,input,select{font-size:12px;}body,.ftb{height:<%=p_hei%>px;line-height:<%=p_hei%>px;}.ftb{width:98%;overflow:hidden;}.fin{font-size:12px;width:100px;}.fsl{font-size:12px;}.fst{font-size:12px;}</style>
<title></title>
</head>
<body id="body" style="background-color:transparent">
<%
On Error Resume Next
dim esupqx
if Request.Cookies(p_qs)<>"" then
esupqx=int(Request.Cookies(p_qs))
else
esupqx=2
end if
if esupqx>=p_qx then
dim errs,eudjj,eudir,eudst,eudhz,euddr,eudco,eudur,euddu,eudfh
errs="<br>"
eudjj=i_upjj
eudir=i_dir&eudjj
eudst=i_upst
eudhz=i_uphz
euddr=i_updr
eudco=i_upco
eudur=i_upur
if eudur="" then eudur="http://"&Request.ServerVariables("HTTP_HOST")&"/"
euddu=i_updu
eudfh=i_upfh
dim esuarr,esugn,esuty,esunm,esusv,esufh,esufm,esufi,esuss,esusn,esupg,esumm
esuarr=split(replace(Request.ServerVariables("QUERY_STRING"),eudhz,""),p_ujg)
if ubound(esuarr)=10 then
esugn=eupre(esuarr(0))
esuty=eupre(esuarr(1))
esunm=eupre(esuarr(2))
esusv=eupre(esuarr(3))
esufh=eupre(esuarr(4))
esufm=eupre(esuarr(5))
esufi=eupre(esuarr(6))
esuss=eupre(esuarr(7))
esusn=eupre(esuarr(8))
esupg=eupre(esuarr(9))
esumm=eupre(esuarr(10))
dim eugpost,eugpostgn,eugpostnm,eugpostpg,eugpostmm,eugm,eugz,eugs,euknm,euknmm,euknmg,euksnmm,euksnmg,eufyn
eugpostgn="?"&p_tjg&p_ujg&esuarr(1)&p_ujg&esuarr(2)&p_ujg&esuarr(3)&p_ujg&esuarr(4)&p_ujg&esuarr(5)&p_ujg&esuarr(6)&p_ujg&esuarr(7)&p_ujg&esuarr(8)&p_ujg&esuarr(9)&p_ujg&eudhz'上传功能转换用
eugpostnm="?"&esuarr(0)&p_ujg&esuarr(1)&p_ujg&p_tjg&p_ujg&esuarr(3)&p_ujg&esuarr(4)&p_ujg&esuarr(5)&p_ujg&esuarr(6)&p_ujg&esuarr(7)&p_ujg&esuarr(8)&p_ujg&esuarr(9)&p_ujg&eudhz'重新上传用
eugpostpg="?"&esuarr(0)&p_ujg&esuarr(1)&p_ujg&esuarr(2)&p_ujg&esuarr(3)&p_ujg&esuarr(4)&p_ujg&esuarr(5)&p_ujg&esuarr(6)&p_ujg&esuarr(7)&p_ujg&esuarr(8)&p_ujg&p_tjg&p_ujg&eudhz'翻页用
eugpostmm="?"&esuarr(0)&p_ujg&esuarr(1)&p_ujg&esuarr(2)&p_ujg&esuarr(3)&p_ujg&esuarr(4)&p_ujg&esuarr(5)&p_ujg&esuarr(6)&p_ujg&esuarr(7)&p_ujg&esuarr(8)&p_ujg&esuarr(9)&p_ujg
Function aiufile(aifty,aifstr,aifex,aifth)
if trim(aifstr)<>"" and trim(aifex)<>"" and trim(aifth)<>"" then
dim aiudrex
Set aiudrex=New RegExp
aiudrex.IgnoreCase=True
aiudrex.Global=True
if aifty=1 then
aiudrex.Pattern="(.*?)"&aifex&"(.*?)"
aifstr=aiudrex.replace(aifstr,""&aifth&"$2")
else
aiudrex.Pattern="(=){1}('|""){0,1}(\S){1,}"&aifex&"(.*?)('|""|\s|>){1}"
aifstr=aiudrex.replace(aifstr,"$1$2"&aifth&"$4$5")
end if
end if
aiufile=aifstr
End Function
'★获取上传绝对地址
Function eupmp(epstr)
eupmp=Server.MapPath(epstr)
if euddr<>"" then
dim eupdmrr,eupdmud
eupdmrr=split(eupmp,replace(eudjj,"/","\"))
eupdmud=ubound(eupdmrr)
if eupdmud>0 then
eupmp=replace(eupmp,eupdmrr(0),euddr)
end if
end if
End Function
Function eupre(epstr)
if epstr=p_tjg or epstr="" or len(epstr)>180 then
eupre="0"
else
eupre=epstr
end if
End Function
Function eupty(epty,epvl)
if epty<>"" then
if int(epty)<p_fll then
if epvl=1 then
Execute("eupty=p_fs"&epty&"")
eupty=eupty*1024
else
Execute("eupty=p_ft"&epty&"")
end if
end if
end if
End Function
Function eupsv(eufty)
dim esvdz
if esusv="0" then
eupsv=eudir
elseif esusv="1" then
eupsv=eudir
esvdz=request.cookies(eudco)
if esvdz<>"" then
if left(esvdz,len(eudfh))=eudfh then
eupsv=replace(esvdz,eudfh,eudir)
elseif left(esvdz,1)="/" then
eupsv=esvdz
else
eupsv=eudir&esvdz
end if
end if
else
if left(esusv,len(eudfh))=eudfh then
eupsv=replace(esusv,eudfh,eudir)
else
eupsv=esusv
end if
end if
if eufty=1 and left(eupsv,1)="/" and len(eupsv)>1 then eupsv=right(eupsv,len(eupsv)-1)
End Function
Function eupfh(epfile)
if epfile<>"" and epfile<>"0" then
eupfh=eupsv(0)
if esufh="0" then'this is err
if left(eupfh,len(eudir))<>eudir then
eupfh=eudir&eupfh
end if
elseif esufh="1" then
eupfh=eudur&eupsv(1)
elseif esufh="2" then
eupfh=""
elseif esufh="3" then
eupfh=aiufile(1,eupfh,eudjj,euddu)
else
eupfh=replace(eupfh,esufh,"")
end if
if esusn="2" then
if epfile="1" then
eupfh=eupfh&eudst
else
eupfh=eupfh&eudst&epfile
end if
elseif esusn="3" then
if epfile="1" then
eupfh=eupfh&eudst&"/"
else
eupfh=eupfh&eudst&"/"&epfile
end if
else
if epfile="1" then
eupfh=eupfh
else
eupfh=eupfh&epfile
end if
end if
end if
End Function
Function eupsn()
dim eupsnSZ,eupsnSS,eupsnRR,eupsnIP
eupsnIP=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if len(eupsnIP)<8 then
eupsnIP="000000"
else
eupsnIP=replace(eupsnIP,".","")
end if
eupsnSZ=36
eupsnSS="0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z"'the sn character
eupsnRR=split(eupsnSS,"|")'the chr. Array
eupsn=eupsnRR(int(right(year(now()),2)))&eupsnRR(int(month(now())))&eupsnRR(int(day(now())))
if int(left(replace(eupsnIP,".",""),2))>eupsnSZ then
eupsn=eupsn&eupsnRR(int(left(replace(eupsnIP,".",""),2))-eupsnSZ)
else
eupsn=eupsn&eupsnRR(int(left(replace(eupsnIP,".",""),2)))
end if
if int(right(replace(eupsnIP,".",""),2))>eupsnSZ then
eupsn=eupsn&eupsnRR(int(right(replace(eupsnIP,".",""),2))-eupsnSZ)
else
eupsn=eupsn&eupsnRR(int(right(replace(eupsnIP,".",""),2)))
end if
eupsn=eupsn&eupsnRR(int(hour(now())))&eupsnRR(abs(int(minute(now()))-28))&eupsnRR(abs(int(second(now()))-28))
Randomize
eupsn=eupsn&eupsnRR(int(eupsnSZ*Rnd))
End Function
Function eupmfolder(anko)
eupmfolder=False
if anko<>"" then
dim eupmfolderfso,ankofs,anfdrr,anfdii,anfdud,anfdir
anfdir=""
On Error Resume Next
if left(anko,1)="/" and right(anko,1)="/" then
ankofs=anko
elseif right(anko,1)="/" and left(anko,1)<>"." then
ankofs=eudir&anko
else
ankofs=anko
end if
anfdrr=split(ankofs,"/")
anfdud=ubound(anfdrr)
If InStr(ankofs,".")>0 or right(ankofs,1)="_" then ankofs=left(ankofs,len(ankofs)-len(anfdrr(anfdud))-1)
if right(ankofs&"/",2)<>"//" then ankofs=ankofs&"/"
ankofs=eupmp(ankofs)
anfdrr=split(ankofs,"\")
anfdud=ubound(anfdrr)
Set eupmfolderfso=Server.CreateObject("Scr" & "ipt" & "ing.Fil" & "eSy" & "ste" & "mOb" & "j" & "ect")
If eupmfolderfso.FolderExists(ankofs) Then
eupmfolder=True
Exit Function
End If
For anfdii=0 To anfdud
anfdir=anfdir&anfdrr(anfdii)&"\"
If Not eupmfolderfso.FolderExists(anfdir) Then
eupmfolderfso.CreateFolder(anfdir)
End If
Next
Set eupmfolderfso=Nothing
If Err=0 Then eupmfolder=True
end if
End Function
Function eupgext(epfile)
if epfile<>"" then
eupgext=lcase(Mid(epfile,InstrRev(epfile,".")))
end if
End Function
Function eupgextce(epfile)
dim eupgzrr
eupgzrr=Split(eupty(esuty,0),",")
For i=0 To Ubound(eupgzrr)
If LCase(Right(epfile,len(eupgzrr(i))))=LCase(eupgzrr(i)) then
eupgextce=True
Exit Function
Else
eupgextce=False
End if
Next
End Function
Function eupgextceimg(epfile)
dim eupgzrr
eupgzrr=Split("jpg,gif,png,bmp",",")
For i=0 To Ubound(eupgzrr)
If LCase(Right(epfile,len(eupgzrr(i))))=LCase(eupgzrr(i)) then
eupgextceimg=True
Exit Function
Else
eupgextceimg=False
End if
Next
End Function
Function eupgsize(epfile)
if epfile="" then
eupgsize=0
Exit Function
end if
dim afsmsxml
set afsmsxml=Server.CreateObject("M" & "S" & "X" & "ML" & "2.X" & "ML" & "HT" & "TP")
afsmsxml.open "GET",epfile,False
afsmsxml.send
eupgsize=int(afsmsxml.GetResponseHeader("Content-Length"))
set afsmsxml=nothing
End Function
Sub eupurlfile(epsvfile,epurlfile)
dim asuado,asuxml,asurdata
Set asuxml=Server.CreateObject("Microsoft.XMLHTTP")
With asuxml
.Open "Get",epurlfile,False,"",""
.Send
asurdata=.ResponseBody
End With
Set asuxml=Nothing
Set asuado=Server.CreateObject("A"&"dod"&"b.St"&"r"&"eam")
With asuado
.Type=1
.Open
.Write asurdata
.SaveToFile epsvfile,2
.Cancel()
.Close()
End With
Set asuado=nothing
End Sub
Sub eupmyfile()
dim eumyfdate,eumyfcrlf,eumyfhead,eumyfado,eumyfado1,eumyfsize,Position
eumyfdate=request.binaryread(request.totalbytes)
eumyfcrlf=chrB(13)&chrB(10)
eumyfhead=leftB(eumyfdate,clng(instrb(eumyfdate,eumyfcrlf))-1)
Position=instrb(eumyfdate,eumyfcrlf&eumyfcrlf)+4
eumyfsize=instrb(Position+1,eumyfdate,eumyfhead)-Position-2
set eumyfado=CreateObject("A"&"dod"&"b.St"&"r"&"eam")
eumyfado.Mode=3:eumyfado.Type=1:eumyfado.Open
set eumyfado1=CreateObject("A"&"dod"&"b.St"&"r"&"eam")
eumyfado1.Mode=3:eumyfado1.Type=1:eumyfado1.Open 
eumyfado.Write eumyfdate
eumyfado.Position=Position-1
eumyfado.CopyTo eumyfado1,eumyfsize
eumyfado1.SaveToFile euknmg,2  ' 文档保存
set eumyfado=nothing:set eumyfado1=nothing
End Sub
Sub eupxsuo(epoldimg,epnewimg)
End Sub
Sub eupxshui(epimg,epsstr)
End Sub
Function euplist(eppath)
End Function


Sub EESaiUpSub()
DIM ASPUpload,ASPUPFile
if esugn=1 then'远程上传
eugpost=request("EESaiUpFile")
if len(eugpost)<3 then Exit Sub
eugm=Mid(eugpost,InstrRev(eugpost,"/")+1)
eugz=eupgext(eugm)
eugs=eupgsize(eugpost)
if p_err=1 then errs=errs&"上传文件属性：远程文件["&eugpost&"]，文件名="&eugm&"|扩展名="&eugz&"|大小="&eugs&"<br>"
elseif esugn=0 then

if p_zjk=1 then'aien
dim aienuoload,aienfile
set aienuoload=new AnUpLoad
aienuoload.SingleSize=eupty(0,1)
aienuoload.MaxSize=eupty(0,1)
aienuoload.Exe=eupty(0,0)
aienuoload.Charset="utf-8"
aienuoload.Mode = 0
aienuoload.GetData()
if aienuoload.ErrorID>0 then 
if p_err=1 then errs=errs&aienuoload.Description&"<br>"
else
set aienfile=aienuoload.files("EESaiUpFile")
IF aienfile.isfile THEN
eugs=aienfile.size
eugm=aienfile.LocalName
eugz=eupgext(eugm)
if p_err=1 then errs=errs&"上传文件：文件名="&eugm&"|扩展名="&eugz&"|大小="&eugs&"<br>"
ELSE
if p_err=1 then errs=errs&"无效的上传操作。<br>"
end if
end if

elseif p_zjk=2 then'aspupload
Set ASPUpload=Server.CreateObject("Persits.Upload")
ASPUpload.SetMaxSize eupty(esuty,1), True
ASPUpload.Save()
If Err.Number=8 Then
if p_err=1 then errs=errs&"错误: 文件过大!"
Else
If Err <> 0 Then
if p_err=1 then errs=errs&"发生错误："&Err.Description
End If
End If
Set ASPUPFile=ASPUpload.Files("EESaiUpFile")
If Not ASPUPFile Is Nothing Then
eugm=ASPUPFile.Filename
eugz=ASPUPFile.Ext
If Err.Number=8 Then ASPUPFile.Delete
If eupgextce(eugz) Then ASPUPFile.Delete
eugs=1
else
eugm=""
eugz=""
eugs=1
end if
else'asai
eugs=Request.TotalBytes
eugpost=esumm
if len(eugpost)<3 then Exit Sub
eugz=eupgext(eugpost)
eugm=Mid(eugpost,InstrRev(eugpost,"\")+1)
if p_err=1 then errs=errs&"上传文件属性：本地文件["&eugpost&"]，文件名="&eugm&"|扩展名="&eugz&"|大小="&eugs&"<br>"
end if

end if


if eugs>0 then
if eupmfolder(eupsv(0)) then
If eugs<eupty(esuty,1) then
if p_err=1 then errs=errs&"文件大小检测："&eugs&"（上传文件大小）<"&eupty(esuty,1)&"<br>"
If eupgextce(eugz) Then
if p_err=1 then errs=errs&"文件扩展名检测："&eugz&"（"&eupty(esuty,0)&"）<br>"
eugz=lcase(replace("."&eugz,"..","."))
if esunm="0" then
euknm=eupsn()
elseif esunm="1" then
euknm=replace(lcase(eugm),eugz,"")
else
euknm=esunm
end if
eugpostnm=replace(eugpostnm,p_ujg&p_tjg&p_ujg,p_ujg&euknm&p_ujg)
euknmm=euknm&eugz
if p_err=1 then errs=errs&"保存文件名："&euknmm&"<br>"
euknmg=eupmp(eupsv(0)&euknmm)
if p_err=1 then errs=errs&"文件储存位置："&euknmg&"<br>"

if esugn=1 then
Call eupurlfile(euknmg,eugpost)
else

if p_zjk=1 then'aien
aienfile.UserSetName=euknm
if aienfile.SaveToFile(eupmp(eupsv(0)),-1,true) then
if p_err=1 then errs=errs&"上传报告：已经成功上传。<br>"
else
if p_err=1 then errs=errs&"上传报告："&aienfile.Exception&"<br>"
end if
set aienfile=nothing
set aienuoload=nothing
elseif p_zjk=2 then'aspupload
ASPUPFile.SaveAs euknmg
else'asai
Call eupmyfile()
end if

end if

if p_err=1 then errs=errs&"<h1>上传文件已保存至："&euknmg&"</h1>"
if esusn="0" then
euksnmg=""
else
if esusn="1" then
euksnmg=euknmg
elseif esusn="2" then
euksnmg=replace(euknmg,euknmm,eudst&euknmm)
elseif esusn="3" then
if eupmfolder(eupsv(0)&"s/") then
euksnmg=replace(euknmg,euknmm,eudst&"\"&euknmm)
end if
end if
if p_err=1 then errs=errs&"缩图储存位置："&euksnmg&"<br>"
end if
if esuss="0" then
esuss=""
else
if p_err=1 then errs=errs&"加水印的内容："&esuss&"<br>"
end if
'综合处理缩图和加水印的请求
if esuss<>"" and euksnmg<>"" then
Call eupxsuo(euknmg,euksnmg)
Call eupxshui(euksnmg,esuss)
elseif euksnmg<>"" then
Call eupxsuo(euknmg,euksnmg)
elseif esuss<>"" then
Call eupxshui(euknmg,esuss)
end if
if esufm<>"0" and esufi<>"0" then
Response.write"<script language=javascript>parent.document."&esufm&"."&esufi&".value='"&eupfh(euknmm)&"';</script>"
if p_err=1 then errs=errs&"返回到表单"&esufm&"的id="&esufi&"的文本框中，值为"&eupfh(euknmm)&"<br>"
elseif esufi<>"0" then
Response.write"<script language=javascript>parent.document.getElementById("""&esufi&""").value='"&eupfh(euknmm)&"';</script>"
if p_err=1 then errs=errs&"返回到id="&esufi&"的文本框中，值为"&eupfh(euknmm)&"<br>"
end if
Response.write "<a href="""&aiufile(1,eupsv(0)&euknmm,eudjj,euddu)&""" target=""_blank"" title=""文件名称："&euknmm&vbcrlf&"文件大小："&int(eugs/1024)&"KB"&vbcrlf&"友情提示：点击打开预览"" style=""color:red;text-decoration:none;"">"
if len(euknmm)>10 then
Response.write left(euknmm,6)&"**"&eugz
else
Response.write euknmm
end if
Response.write"</a> 上传成功!<a href="""&eugpostnm&""">重新上传</a>"
eufyn="1"
else
Response.write"<span style=""color:red;"" title=""仅限上传"&replace(eupty(esuty,0),",","、")&"格式"">文件格式不正确!</span> <a href="""&eugpostnm&""">重新上传</a>"
end if
else
Response.Write"<span style=""color:red;"" title=""文件过大，"&eugs&"KB"">大小超过"&eupty(esuty,1)&"B!</span> <a href="""&eugpostnm&""">重新上传</a>"
end if
else
if p_err=1 then errs=errs&"文件夹不存在，且创建文件夹操作失败。<br>"
end if
end if
End Sub
%>
<table class="ftb" title="可上传文件类型：<%=eupty(esuty,0)%>
可上传文件大小：=< <%=eupty(esuty,1)/1024%>KB<%if eupsv(0)<>"" then%>
上传文件保存至：<%=eupsv(0)%><%if len(esunm)>1 then%>
上传文件新名称：<%=esunm%><%end if%><%end if%>" border="0" cellspacing="0" cellpadding="0"><tr><td width="108"><script language="Javascript">function AsaiJumpHref(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if (restore) selObj.selectedIndex=0;}</script><%
if esugn=2 then
%><script language="Javascript">
function AsaiInputS(inpname){
<%if esufm<>"0" and esufi<>"0" then%>
parent.document.<%=esufm%>.<%=esufi%>.value='<%=eupfh("1")%>'+inpname+'';
<%elseif esufi<>"0" then%>
parent.document.getElementById("<%=esufi%>").value='<%=eupfh("1")%>'+inpname+'';
<%end if%>
}
</script>
<%=euplist(eupsv(0))%>
<%else
Call EESaiUpSub()
if eufyn<>"1" then
%><script language="Javascript">
function AsaiCheckFile(){
if(document.EESaiUpForm.EESaiUpFile.value=="")
{alert("请选择上传文件！")
document.EESaiUpForm.EESaiUpFile.focus()
return false}
document.EESaiUpForm.action="<%=eugpostmm%>"+document.EESaiUpForm.un.value+"<%=eudhz%>";
return true}
</script><form method="post" id="EESaiUpForm" name="EESaiUpForm" onSubmit="return AsaiCheckFile()" action=""<%if esugn=0 then%> enctype="multipart/form-data"<%end if%>><%
if esugn=1 then
%><input class="fin" type="text" id="EESaiUpFile" name="EESaiUpFile" onpropertyChange="document.EESaiUpForm.un.value=this.value" onChange="document.EESaiUpForm.un.value=this.value" value=""><input type="hidden" id="un" name="un" value=""><%
elseif esugn=0 then
%><input class="fin" type="file" id="EESaiUpFile" name="EESaiUpFile" onpropertyChange="document.EESaiUpForm.un.value=this.value" onChange="document.EESaiUpForm.un.value=this.value"><input type="hidden" id="un" name="un" value=""><%
end if
%></td><td width="58"><select class="fsl" language="javascript" onChange="AsaiJumpHref('self',this,0)" name="aty" id="aty">
<option <%if esugn=0 then%>selected="selected" <%end if%>value="<%=replace(eugpostgn,"?"&p_tjg&p_ujg,"?0"&p_ujg)%>">本地</option>
<option <%if esugn=1 then%>selected="selected" <%end if%>value="<%=replace(eugpostgn,"?"&p_tjg&p_ujg,"?1"&p_ujg)%>">远程</option>
</select></td><td><input class="fst" type="submit" value="上传"></form><%
end if
if p_err=1 then Response.Write errs
end if%>
</td></tr></table>
<%
else
Response.Write "<script language=javascript>alert('上传配置出错或操作有误！');</script>"
Response.End()
end if
response.Write("<span style=""color:#999;"" title=""会员登录并完成认证后可上传文件"">可以直接输入完整的文件图片地址</span>")
end if
%>
</body>
</html>