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报错的问题。
    我不是高手,我只是有点思想的代码搬动工。

  • 相关阅读:
    Integer值判断是否相等问题
    Java连接Redis
    oracle 10G 没有 PIVOT 函数怎么办,自己写一个不久有了
    前端修炼(第三天)函数
    前端 JS 修炼(第一天)包装对象、作用域、创建对象
    linux oracle 启动全过程
    「android」webview中文乱码
    「dos」bat单条命令跨多行
    「股票」东方财富网公式-缩量
    「android」as javadoc乱码
  • 原文地址:https://www.cnblogs.com/djiz/p/15005270.html
Copyright © 2011-2022 走看看