新微赢技术网

标题: [求助]这段是什么意思指教一下 [打印本页]

作者: 30岁就改变    时间: 2010-1-15 04:31
标题: [求助]这段是什么意思指教一下
'========================
Sub BuildUploadRequest(RequestBin, UploadRequest)
'========================
'Get the boundary
PosBeg=
PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr()))
boundary=MidB(RequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos=InstrB(,RequestBin,boundary)
'Get all data inside the boundaries
Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
'Members variable of objects are put in a dictionary object
Dim UploadControl
Set UploadControl=CreateObject("Scripting.Dictionary")
'Get an object name
Pos=InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition"))
Pos=InstrB(Pos,RequestBin,getByteString("name="))
PosBeg=Pos+6
PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr()))
Name=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
PosFile=InstrB(BoundaryPos,RequestBin,getByteString("filename="))
PosBound=InstrB(PosEnd,RequestBin,boundary)
'Test if object is of file type
If PosFile<>0 AND (PosFile<PosBound) Then
'Get Filename, content-type and content of file
PosBeg=PosFile + 0
PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr()))
FileName=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
FileName=Mid(FileName,InStrRev(FileName,"\")+)
'Add filename to dictionary object
UploadControl.Add "FileName", FileName
Pos=InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
PosBeg=Pos+
PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr()))
'Add content-type to dictionary object
ContentType=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add "ContentType",ContentType
'Get content of object
PosBeg=PosEnd+
PosEnd=InstrB(PosBeg,RequestBin,boundary)-
Value=FileName
ValueBeg=PosBeg-
ValueLen=PosEnd-Posbeg
Else
'Get content of object
Pos=InstrB(Pos,RequestBin,getByteString(chr()))
PosBeg=Pos+
PosEnd=InstrB(PosBeg,RequestBin,boundary)-
Value=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
ValueBeg=0
ValueEnd=0
End If
UploadControl.Add "Value" , Value
UploadControl.Add "ValueBeg" , ValueBeg
UploadControl.Add "ValueLen" , ValueLen
UploadRequest.Add name, UploadControl
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
Loop
End Sub
作者: 斷々弦    时间: 2010-1-15 04:31
文件上传代码




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2