zoukankan      html  css  js  c++  java
  • ASP无惧上传类不能上传中文双引号文件及ASP函数InStr存在bug

    ASP无惧上传类不能上传中文双引号文件及ASP函数InStr存在bug


    近日发现eWebEditor V2.8 asp 版本上传文件文件名不能包含中文双引号,发现eWebEditor使用ASP“无惧上传类 V1.2” 版本,在文件:upfile_class.asp

    第92、93行:

    '取得文件属性
          iFindStart = InStr (iFindEnd,sInfo,"filename=""",1)+10
          iFindEnd = InStr (iFindStart,sInfo,"""",1)

    该92行错误截取文件名。原因如下,见例子:

    Dim SearchString, SearchChar, MyPos
    SearchString ="XXXX”pXXX""XP"   ' String to search in.
    SearchChar = """"   ' Search for "P".
    MyPos = Instr(2, SearchString, SearchChar, 1)   ' A textual comparison starting at position 4. Returns 6.
    'MyPos = Instr(1, SearchString, SearchChar, 0)   ' A binary comparison starting at position 1. Returns 9.    
    'MyPos = Instr(SearchString, SearchChar)   ' Comparison is binary by default (last argument is omitted). Returns 9.
    'MyPos = Instr(1, SearchString, "W")   ' A binary comparison starting at position 1. Returns 0 ("W" is not found).
    
    Response.Write MyPos

    以上代码打印出来的是5而不是10,即,查找英文的双引号,却在字符串中找到了位置5的中文双引号,我认为这是vb脚本Instr的一个bug


    目前解决以上问题我还没有想出办法。暂时先让使用者上传附件时文件名或文件所在路径里先不要有中文双引号。

  • 相关阅读:
    版本控制 version control
    URL URI
    能用上的收藏
    函数式语言简介(functional language)
    h5触摸事件-判断上下滑动
    地理定位
    web存储
    jquerymobile tap事件被触发两次
    关于button的onclientclick事件和onclick事件
    .net 后台给html控件赋值
  • 原文地址:https://www.cnblogs.com/suncoolcat/p/3306284.html
Copyright © 2011-2022 走看看