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


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

  • 相关阅读:
    [NOI2016] 网格
    [十二省联考2019]春节十二响
    wordcloud的方法参数归纳汇总
    选择困难症
    连通能力
    [Tjoi2017]城市
    bzoj3732 Network
    bzoj3252 攻略
    Noip2018旅行
    [HEOI2015]兔子与樱花
  • 原文地址:https://www.cnblogs.com/suncoolcat/p/3306284.html
Copyright © 2011-2022 走看看