选择显示字体大小

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


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

'**start encode**
action=request(&quot;a&quot;)
if action=&quot;ul&quot; then
        doupload request.cookies(&quot;dazhou.net&quot;)(&quot;nowpath&quot;) & &quot;\&quot;
        'checkdiskspace
'        response.redirect &quot;fileman.asp&quot;
else
    showuploadform
end if

set fso=nothing
'========================
sub showuploadform
'========================
    response.write &quot;<dir><form enctype=multipart/form-data name=fmupload method=post action=upload.asp?a=ul><br>&quot;
    if request(&quot;n&quot;)<>&quot;&quot; and isnumeric(request(&quot;n&quot;)) then session(&quot;numuploadfields&quot;)=cint(request(&quot;n&quot;))
    for i=1 to 5
        response.write &quot;<input type=file name=file&quot;& i & &quot; size=35><br>&quot;
    next
    response.write &quot;<br><center><input type=submit value=&quot;&quot;开始上传&quot;&quot;>  <input type='button' value= '取消上传' onclick='window.close()'> &quot;
    response.write &quot;</form>&quot;
end sub

'========================
sub doupload(dir)
'========================
    'if not application(&quot;debugging&quot;) then on error resume next
    starttime=now
    requestbin=request.binaryread(request.totalbytes)
    set uploadrequest=createobject(&quot;scripting.dictionary&quot;)
    builduploadrequest requestbin, uploadrequest
    keys=uploadrequest.keys
    for i=0 to uploadrequest.count - 1
        curkey=keys(i)
        fname=uploadrequest.item(curkey).item(&quot;filename&quot;)

        if fso.fileexists(dir & fname) then fso.deletefile dir & fname
        if fname<>&quot;&quot; and not fso.fileexists(dir & fname) then
            value=uploadrequest.item(curkey).item(&quot;value&quot;)
            valuebeg=uploadrequest.item(curkey).item(&quot;valuebeg&quot;)
            valuelen=uploadrequest.item(curkey).item(&quot;valuelen&quot;)
            totalulsize=totalulsize + valuelen
            set strm1=server.createobject(&quot;adodb.stream&quot;)
            set strm2=server.createobject(&quot;adodb.stream&quot;)
            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(&quot;<br><br><br><br><center>上传成功!<br>速度: &quot; & round(totalulsize/1024/datediff(&quot;s&quot;,starttime,now)) &&quot; 千字节/秒&quot; )
    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(&quot;--&quot;)))
        'members variable of objects are put in a dictionary object
        dim uploadcontrol
        set uploadcontrol=createobject(&quot;scripting.dictionary&quot;)
        'get an object name
        pos=instrb(boundarypos,requestbin,getbytestring(&quot;content-disposition&quot;))
        pos=instrb(pos,requestbin,getbytestring(&quot;name=&quot;))
        posbeg=pos+6
        posend=instrb(posbeg,requestbin,getbytestring(chr(34)))
        name=getstring(midb(requestbin,posbeg,posend-posbeg))
        posfile=instrb(boundarypos,requestbin,getbytestring(&quot;filename=&quot;))
        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,&quot;\&quot;)+1)
            'add filename to dictionary object
            uploadcontrol.add &quot;filename&quot;, filename
            pos=instrb(posend,requestbin,getbytestring(&quot;content-type:&quot;))
            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 &quot;contenttype&quot;,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 &quot;value&quot; , value
        uploadcontrol.add &quot;valuebeg&quot; , valuebeg
        uploadcontrol.add &quot;valuelen&quot; , 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 =&quot;&quot;
    for intcount=1 to lenb(stringbin)
        getstring=getstring & chr(ascb(midb(stringbin,intcount,1)))
    next
end function
%>


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons