动态网站制作指南
[  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
电脑书籍下载:程序设计书籍 | 数据库教程书籍 | 平面与多媒体书籍 | 网络通讯书籍 | 系统管理书籍 | 网络安全书籍 | 认证考试书籍
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,迁移,结构,破解,编译,配置,进程
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ ASP实例 ]的信息

本月文章推荐
.使用asp实现支持附件的邮件系统(.
.用asp怎样编写文档搜索页面(3).
.一个用asp+存取数据库的例子.
.1栏分页显示(附显示的形式[1][2.
.用密码保护页面 (III).
.ASP实现播放Flash的例子.
.搜索按钮(客户端表单).
.仿照CHINAASP论坛中TOP10写的部分.
.天气预报的小偷,可以偷到全国24小.
.限制只能中文输入的方法.
.几例在ASP存储过程的使用方法.
.一个免费的简单聊天室源代码.
.一个功能完善的专栏管理的程序-&.
.使用JScript.NET创建asp.net页面.
.利用ASP存取各种常用类型数据库(.
.bbs树形结构的实现方法(三).
.在ASP中使用Oracle数据库.
.磁盘ID在ASP源码防拷贝中的应用.
.用户注册及跟踪代码(一).
.负载平衡环境下的ASP会话管理(2).

一个的无组件上传的ASP代码

文章类别:ASP实例 | 发表日期:2002-1-24 |


<!--#include file="../lib/filelib.asp"-->
<%
    Response.write "<title>上传文件至当前文件夹</title>"
    Response.Write "<body bgcolor=""#D6D3CE"" leftmargin=""0"" topmargin=""0"" title = ""    请您遵守国家相关法律法规上传文件。上传前请杀毒,否则系统将会自动删除此文件!"">"

'**Start Encode**
Action=Request("A")
If Action="UL" Then
        DoUpload Request.Cookies("DAZHOU.NET")("nowpath") & "\"
        'CheckDiskSpace
'        Response.redirect "fileman.asp"
Else
    ShowUploadForm
End If

Set fso=Nothing
'========================
SUB ShowUploadForm
'========================
    Response.write "<Dir><form enctype=multipart/form-data name=fmupload method=Post action=Upload.asp?A=UL><br>"
    If Request("n")<>"" AND IsNumeric(Request("n")) Then Session("NumUploadFields")=CInt(Request("n"))
    For i=1 to 5
        Response.Write "<INPUT type=file name=file"& i & " size=35><br>"
    Next
    Response.Write "<br><center><INPUT type=submit value=""开始上传"">  <INPUT type='button' value= '取消上传' onclick='window.close()'> "
    Response.Write "</form>"
End SUB

'========================
SUB DoUpload(Dir)
'========================
    'If NOT Application("Debugging") Then On Error resume next
    StartTime=Now
    RequestBin=Request.BinaryRead(Request.TotalBytes)
    Set UploadRequest=CreateObject("Scripting.Dictionary")
    BuildUploadRequest RequestBin, UploadRequest
    keys=UploadRequest.Keys
    For i=0 to UploadRequest.Count - 1
        curKey=keys(i)
        fName=UploadRequest.Item(curKey).Item("FileName")

        If fso.FileExists(Dir & fName) Then fso.deletefile Dir & fName
        If fName<>"" AND NOT fso.FileExists(Dir & fName) Then
            value=UploadRequest.Item(curKey).Item("Value")
            valueBeg=UploadRequest.Item(curKey).Item("ValueBeg")
            valueLen=UploadRequest.Item(curKey).Item("ValueLen")
            TotalULSize=TotalULSize + valueLen
            Set strm1=Server.CreateObject("ADODB.Stream")
            Set strm2=Server.CreateObject("ADODB.Stream")
            strm1.Open
            strm1.Type=1 'Binary
            strm2.Open
            strm2.Type=1 'Binary
            strm1.Write RequestBin
            strm1.Position=ValueBeg
            strm1.CopyTo strm2,ValueLen
            strm2.SaveToFile Dir & fName,2
            Set strm1=Nothing
            Set strm2=Nothing
        End If
     Next
    If Now>StartTime Then Response.Write("<br><br><br><br><center>上传成功!<br>速度: " & Round(TotalULSize/1024/DateDiff("s",StartTime,Now)) &" 千字节/秒" )
    Set UploadRequest=Nothing
End SUB

'========================
Sub BuildUploadRequest(RequestBin, UploadRequest)
'========================
    'Get the boundary
    PosBeg=1
    PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr(13)))
    boundary=MidB(RequestBin,PosBeg,PosEnd-PosBeg)
    boundaryPos=InstrB(1,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(34)))
        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 + 10
            PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr(34)))
            FileName=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
            FileName=Mid(FileName,InStrRev(FileName,"\")+1)
            'Add filename to dictionary object
            UploadControl.Add "FileName", FileName
            Pos=InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
            PosBeg=Pos+14
            PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr(13)))
            'Add content-type to dictionary object
            ContentType=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
            UploadControl.Add "ContentType",ContentType
            'Get content of object
            PosBeg=PosEnd+4
            PosEnd=InstrB(PosBeg,RequestBin,boundary)-2
            Value=FileName
            ValueBeg=PosBeg-1
            ValueLen=PosEnd-Posbeg
        Else
            'Get content of object
            Pos=InstrB(Pos,RequestBin,getByteString(chr(13)))
            PosBeg=Pos+4
            PosEnd=InstrB(PosBeg,RequestBin,boundary)-2
            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

'====================================
Function getByteString(StringStr)
'====================================
    For i=1 to Len(StringStr)
         char=Mid(StringStr,i,1)
        getByteString=getByteString & chrB(AscB(char))
    Next
End Function

'====================================
Function getString(StringBin)
'====================================
    getString =""
    For intCount=1 to LenB(StringBin)
        getString=getString & chr(AscB(MidB(StringBin,intCount,1)))
    Next
End Function
%>


上一篇:ASP 编程中 15 个非常有用的例子 人气:18367
下一篇:利用ASP实现三个强大功能之一 人气:13676
点击此处浏览全部上传的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-5-16 乘风多用户PHP统计系统 v3.4
2008-5-16 轩溪下载系统 v3.78 build 0515
2008-5-16 普沙B2B 浙江省商贸网 v2.0
2008-5-16 asp抓蜘蛛的小程序 v1.0
2008-5-16 齐齐乐网私服发布站 仿haosf新版
2008-5-16 IssTech信息反馈系统 v1.0
2008-5-16 自由领域大头贴(js接口版) 修正版
2008-5-16 医院网站系统
2008-5-16 智拓-分类信息管理系统 v5.0
2008-5-7 Windows XP SP3 官方英文版
2008-5-7 Windows XP SP3 官方香港中文版
2008-5-7 Windows XP SP3 官方繁体中文版
2008-5-7 Windows XP SP3 官方简体中文版
2008-4-30 Multiple Unzip Wizard 1.02
2008-4-30 Multiple Unrar Wizard 1.0.0
2008-4-30 WinZip Install/Try/Uninstall a
2008-4-30 ZIP压缩文件修复器WzipFix 2.0
2008-4-30 Pentazip 6.01 Build 189 For Wi
  发表评论
姓 名: 验证码: [ 全部贴吧 ] [ 浏览评论 ]
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報