日期:2014-05-16 浏览次数:20910 次
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