网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.ASP+SQL Server之图象数据处理.
.纯猝使用VBScript来实现加密.
.安全技巧:配置 IIS 4.0 证书鉴定.
.一条sql 语句搞定数据库分页.
.XML技术上传文件.
.WINDOWS 2000搭載ASP3.0和IIS5.0.
.用.net开发asp组件.
.动态网站首页的静态生成方法.
.一个简单的asp数据库操作类.
.防范sql注入式攻击js版本.
.ASP创建EXCHANGE用户的一段代码.
.通过地址栏传递参数.通过url传递.
.浅谈ASP中Request对象获取客户端.
.使用ADO批量更新记录(源代码).
.javascript动态装入XML数据.
.二十八条改善 ASP 性能和外观的技.
.转换文本为超联和Email格式的代码.
.Access数据库操作中出现的怪现象.
.使用速度更快的OLEDB取代ODBC连结.
.将连接数据库的代码隐藏在DLL中.

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

发表日期:2001-3-27


'---- 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
            
            '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
            PosEnd = InstrB(PosBeg,strRequestBin,boundary)-2
            Value = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))
        End If

        'Add content to dictionary object
        UploadControl.Add "Value" , Value

        'Add dictionary object to main dictionary
        Set UploadRequest(Name) = UploadControl

        'Loop to next object
        BoundaryPos = InstrB(BoundaryPos+LenB(boundary),strRequestBin,boundary)
    Loop
End Function

'String to byte string conversion
Public Function getByteString(strString)
    Dim intCount

    getByteString = ""

    For intCount = 1 to Len(strString)
        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
%>

上一篇:IIS 处理 SEARCH 请求漏洞 人气:9467
下一篇:不用组件实现上载功能(2) 人气:12357
浏览全部的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐