'---- file name /upaoad.asp/
javascript技巧尽在快乐开发
<%
Public Function BuildUploadRequest(strRequestBin)
Dim PosBeg, PosEnd, boundary, boundaryPos
一起娱乐网01716.com
'Get the boundary
devjoy.cn技术文档
PosBeg = 1
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(13)))
boundary = MidB(strRequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos = InstrB(1,strRequestBin,boundary)
'Get all data inside the boundaries
Do until (boundaryPos = InstrB(strRequestBin,boundary & getByteString("--")))
'Members variable of objects are put in a dictionary object
Dim UploadControl
快乐开发技术文档
Set UploadControl = CreateObject("Scripting.Dictionary")
Dim Pos, Name
'Get an object name
Pos = InstrB(boundaryPos,strRequestBin,getByteString("Content-Disposition"))
javascript技巧尽在快乐开发
Pos = InstrB(Pos,strRequestBin,getByteString("name="))
PosBeg = Pos + Len("name=") + 1
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(34)))
Name = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))
Dim PosFile, PosBound, ContentType, Value
'Test if object is of file type
devjoy.cn技术文档
PosFile = InstrB(BoundaryPos,strRequestBin,getByteString("filename="))
PosBound = InstrB(PosEnd,strRequestBin,boundary)
If PosFile <> 0 AND PosFile < PosBound Then
zhangyongjun.com开发网 'Get FilePathName of the file
PosBeg = PosFile + Len("filename=") + 1
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(34)))
FilePathName = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))
一起娱乐网01716.com 'Add filename(with path) to dictionary object
UploadControl.Add "FilePathName", FilePathName
'Get Content-Type of the file
快乐开发技术文档
Pos = InstrB(PosEnd,strRequestBin,getByteString("Content-Type:"))
zhangyongjun.com开发网 PosBeg = Pos + Len("Content-Type:") + 1
.net开发技术文章
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(13)))
一起娱乐网01716.com ContentType = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))
'Add content-type to dictionary object
UploadControl.Add "ContentType",ContentType
zhangyongjun.com开发网 'Get content of object
PosBeg = PosEnd + 4
PosEnd = InstrB(PosBeg,strRequestBin,boundary)-2
Value = MidB(strRequestBin,PosBeg,PosEnd-PosBeg)
Else
'Get content of object
Pos = InstrB(Pos,strRequestBin,getByteString(chr(13)))
PosBeg = Pos + 4
zhangyongjun.com开发网
PosEnd = InstrB(PosBeg,strRequestBin,boundary)-2
Value = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))
End If
Powered By Achely's Blog
.net开发技术文章
'Add content to dictionary object
UploadControl.Add "Value" , Value
'Add dictionary object to main dictionary
Set UploadRequest(Name) = UploadControl
zhangyongjun.com开发网
'Loop to next object
devjoy.cn技术文档 BoundaryPos = InstrB(BoundaryPos+LenB(boundary),strRequestBin,boundary)
devjoy.cn技术文档
Loop
一起娱乐网01716.com
End Function
'String to byte string conversion
Public Function getByteString(strString)
Dim intCount
javascript技巧尽在快乐开发
getByteString = ""
一起娱乐网01716.com
For intCount = 1 to Len(strString)
devjoy.cn技术文档
getByteString = getByteString & chrB(AscB(Mid(strString,intCount,1)))
Next
End Function
'Byte string to string conversion
Public Function getString(strString)
Dim intCount
getString = ""
快乐开发技术文档
For intCount = 1 to LenB(strString)
getString = getString & chr(AscB(MidB(strString,intCount,1)))
Next
End Function
javascript技巧尽在快乐开发
%>