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报错的问题。
我不是高手,我只是有点思想的代码搬动工。
asp分块读取解决ueditor 上传文件200K限制问题
[db:回答]