var fileName = $.trim($("#realFile").val());
if(fileName.length>0 && fileName != ''){
var idx = fileName.lastIndexOf(".");
var suffix = fileName.substring(idx+1);
if(suffix.toLowerCase() != 'pdf' && suffix.toLowerCase() != 'doc' && suffix.toLowerCase() != 'xls'){
$("#fileMsg").html("文件必须为pdf、doc或xls格式");
$("#fileMsg").css("color","red");
return;
}
}
//文件判断
var fileName = $("input[type='file'][name=upload]").each(function(){
var realName = $(this).val();
var fileIndx = $(this).attr("fileIndx");
if(realName.length>0 && realName != ''){
var idx = realName.lastIndexOf(".");
var suffix = realName.substring(idx+1);
if(suffix.toLowerCase() != 'pdf' && suffix.toLowerCase() != 'doc' && suffix.toLowerCase() != 'xls' && suffix.toLowerCase() != 'txt' && suffix.toLowerCase() != 'rtf' && suffix.toLowerCase() != 'xlsx' && suffix.toLowerCase() != 'docx' && suffix.toLowerCase() != 'wps'){
$("#fileMsg"+fileIndx).html("文件必须为txt,pdf,rtf,xls,xlsx,doc,docx,wps格式");
$("#fileMsg"+fileIndx).css("color","red");
return;
}
}
});