不用组件实现上载功能(1)

a35924910

a35924910

2016-01-29 18:22

不用组件实现上载功能(1),不用组件实现上载功能(1)
  '---- 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
            UploadControl.Add "ContentType",ContentType
           &
展开更多 50%)
分享

猜你喜欢

不用组件实现上载功能(1)

ASP
不用组件实现上载功能(1)

不用组件实现上载功能(2)

ASP
不用组件实现上载功能(2)

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

不用组件实现Ajax效果.(1)

Web开发
不用组件实现Ajax效果.(1)

不用组件来实现StrCat函数的功能

ASP
不用组件来实现StrCat函数的功能

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

不用组件实现Ajax效果

Web开发
不用组件实现Ajax效果

不用组件实现Ajax效果.(2)

Web开发
不用组件实现Ajax效果.(2)

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

加密你的Access数据库

加密你的Access数据库

Win2000/XP自启动程序解析

Win2000/XP自启动程序解析
下拉加载更多内容 ↓