zoukankan      html  css  js  c++  java
  • asp分块读取解决ueditor 上传文件200K限制问题

    虽说现在asp技术已然明白黄花,自己也用的asp.net上传组件,但老的iis和老的程序遗留问题,asp技术还是小强般顽强的生存着,在这未淘汰的程序上用上百度的ueditor在线编辑器,能更好的兼容使用新技术的浏览器。

    在iis上默认是有200k上传限制的,如果图片大于200k(程序报错:没有权限操作),在asp版的ueditor上是无法上传成功的,为了解决这个问题,又想到了神一般的上传组件无惧上传,它能把上传获取的数据分成64k一块来写入服务器,想到全部改写ueditor的上传组件有点耗时还麻烦,那就改进它吧,打开:

    ueditoraspuploader.class.asp,定位到424行附近(或者搜索 Request.BinaryRead ):


    formBytes = Request.BinaryRead( Request.TotalBytes )处,把这三行: 

     'formBytes = Request.BinaryRead( Request.TotalBytes )
     'Set stream = OpenStream( adTypeBinary )
     'stream.Write formBytes

    注释掉,或删除,在前面插入:

     'formBytes = Request.BinaryRead( Request.TotalBytes )
            
            'Set stream = OpenStream( adTypeBinary )
                'stream.Write formBytes
            
             Set stream = OpenStream( adTypeBinary )       
    
             '循环分块读取
    
            dim ReadBytes,nTotalBytes
    
             ReadBytes = 0
             nTotalBytes = Request.TotalBytes
    
             Do While ReadBytes < nTotalBytes
    
             '分块读取
    
                nPartBytes = 64 * 1024 '分成每块64k
    
                 If nPartBytes + ReadBytes > nTotalBytes Then
    
                     nPartBytes = nTotalBytes - ReadBytes
    
                 End If 
    
                 stream.Write Request.BinaryRead(nPartBytes)
    
                 ReadBytes = ReadBytes + nPartBytes
    
             Loop      
    
             stream.Position = 0
    
             formBytes = stream.Read

    即可解决asp版ueditor上传iis服务器默认200k报错的问题。
    我不是高手,我只是有点思想的代码搬动工。

  • 相关阅读:
    shell数组(产生不同的随机数)
    统计服务连接状况
    子网掩码与子网划分
    oracle 12g sqlplus安装
    MySQL的备份和还原
    mysql日志
    mysql用户和权限管理
    mysql show
    CentOS Linux解决Device eth0 does not seem to be present
    mysqldump命令详解(转载)
  • 原文地址:https://www.cnblogs.com/djiz/p/15005270.html
Copyright © 2011-2022 走看看