设为首页 加入收藏

TOP

不用组件实现上载功能(英文NT)
2011-05-31 18:06:09 来源: 作者: 【 】 浏览:525次 评论:0
'---- file name /upaoad.asp/
<%
Public Function BuildUploadRequest(strRequestBin)
Dim PosBeg, PosEnd, boundary, boundaryPos
'Get the boundary
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"))
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
PosFile = InstrB(BoundaryPos,strRequestBin,getByteString("filename="))
PosBound = InstrB(PosEnd,strRequestBin,boundary)
If PosFile <> 0 AND PosFile < PosBound Then
'Get FilePathName of the file
PosBeg = PosFile + Len("filename=") + 1
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(34)))
FilePathName = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))
'Add filename(with path) to dictionary object
UploadControl.Add "FilePathName", FilePathName
'Get Content-Type of the file
Pos = InstrB(PosEnd,strRequestBin,getByteString("Content-Type:"))
PosBeg = Pos + Len("Content-Type:") + 1
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(13)))
ContentType = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))
'Add content-type to dictionary object
您看到此篇文章时的感受是:
Tags: 责任编辑:administrator
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到QQ空间
分享到: 
上一篇MSGBOX返回值 下一篇不用组件实现上载功能(英文NT)2

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

相关栏目

最新文章

图片主题

热门文章

推荐文章

相关文章

广告位