看你这么有心,发个我曾经用过的比较简单的上传代码给你分析下,可以在此基础上进行修改,看看能否对你有帮助!
程序代码:
<%response.codepage=65001%>
<%response.charset="UTF-8"%>
<%
'cc="wo我.,;32"
'response.write chrB(10)
Function BIN2STR(xBinary,Charset)
Dim RS, LBinary,Binary
Binary = xBinary
Const adLongVarChar = 201
Set RS = CreateObject("ADODB.Stream")
RS.Type = 1
RS.Mode =3
LBinary = LenB(Binary)
if LBinary>0 then
RS.Open
RS.Write Binary
RS.Position = 0
RS.Type = 2
RS.Charset = Charset
BIN2STR = RS.Readtext
Else
BIN2STR = ""
End If
End Function
Function bytes2BSTR(vIn)
Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,NextCharCode
strReturn = ""
For i = 1 to LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i + 1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
if request.querystring("act")="act1" then
a=Request.TotalBytes
dd=request.binaryread(a)
e=chrB(13)&chrB(10)
'response.write bytes2BSTR(dd)
set h=server.createobject("adodb.stream")
h.type=1
h.open
h.write dd
h.Position=0
d=h.read
f=instrb(d,e)
g=instrb(f+1,d,e)
response.write f&"<br/>"&g
set c=server.createobject("adodb.stream")
c.type=1
c.open
h.position=f+1
h.copyto c,g-f-3
c.position=0
c.type=2
c.charset="utf-8"
i=c.readtext
response.write "<br/>"&i&"<br/>"
response.write BIN2STR(dd,"utf-8")
c.close
j=mid(i,instrrev(i,"\")+1,g)
response.write "<br/>"&j&"<br/>"
k=right(j,len(j)-instr(j,"."))
response.write k
end if
%>
<form enctype="multipart/form-data" action="?act=act1" method="post">
<input type="file" name="n" />
<input name="submit" type="submit" value="提交" />
</form>
这个代码是一个完整体,可以用这些代码直接上传任何文件,并无限制,你如果要敢时间就直接拿去用,不懂的,有问题就继续问!