IE中的文件名包含文件路径

时间:2015-11-20 03:27:12

标签: internet-explorer

我有以下代码,IE和其他人之间的行为不同。 FileItem.getName()总是无法通过我的函数来检查IE浏览器中的无效文件名。别人好!

FileItem item =xxxx;
String fileName = item.getName();
IsLegalFileName(fileName);

// it always show invalid file name from below function
public static boolean IsLegalFileName(String str){
        boolean isValid = true;
        int i;

        String[] badChars = {"/","\\",":","*","?","\"" ,"<",">"};

        for (i = 0; i < badChars.length; i++){
            if (str.indexOf(badChars[i]) >= 0)
            {
                isValid = false;
                break;
            }
        }
        return isValid;
    }

0 个答案:

没有答案