您现在的位置:首页 >> 建站技巧 >> 内容

asp版百度ueditor在线编辑器上传图片大于200k问题修复

时间:2020-12-28 点击:

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

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

ueditor\asp\MultiformProcessor.class.asp,定位到70行:

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


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

附:当然,可以改iis服务器配置文件的话,也能解决上传大于200k文件的问题,以下内容复制网上:
先在服务里关闭iis admin service服务(运行里输入 iisreset /stop),找到windows\system32\inesrv\下的metabase.xml, 打开,找到ASPMaxRequestEntityAllowed 把他修改为需要的值,默认为204800,即200K,如把它修改为51200000(50M)。
然后重启iis admin service服务。(运行里输入 iisreset /restart)

版本信息:V4.06
软件大小:2.35MB
更新时间:2023-05-13



输入域名后查询,如laoy.net

购买咨询

QQ:97065691
商业技术支持

QQ:22862559

QQ:3978698