a=Request.TotalBytes
response.write a
response.end
if a>0 Then
Set c=Createobject("adodb.stream")
c.Type=1
c.Open
c.Write Request.BinaryRead(a)
c.Position=0
d=c.Read
e=chrB(13)&chrB(10)
f=Instrb(d,e)
g=Instrb(f+1,d,e)
set h=Createobject("adodb.stream")
h.Type=1
h.Open
c.Position=f+1
c.Copyto h,g-f-3 // c.Copyto h,g-f-3 中的g-f-3 什么意思??
h.Position=0
h.type=2
h.charset="gb2312"
i=h.Readtext
h.close
j=mid(i,InstrRev(i,"\")+1,g)
set fso=server.createobject("scripting.filesystemobject")
if fso.FileExists(server.mappath(j)) then
i=1
msg=true
do while msg
m=left(j,instr(j,".")-1)&"("&i&")"&right(j,len(j)-instr(j,".")+1)
response.write m&"<br>"
if not fso.FileExists(server.mappath(m)) then
j=m
msg=false
end if
i=i+1
loop
end if
set fso=nothing
k=Instrb(d,e&e)+4
l=Instrb(k+1,d,leftB(d,f-1))-k-2
h.Type=1
h.Open
c.Position=k-1
c.CopyTo h,l
h.SaveToFile server.mappath(j),2
response.write "<script> alert('上传成功!');window.location.href='aa.asp'</script>"
end if