我在将文件上传到文件上传控件后验证文件类型。在验证中,我允许.xls文件类型。但在某些浏览器中不允许使用.xls文件。
可能是什么问题?
var fileExt = ["application/pdf","application/msword", "image/gif", "image/jpeg",
"image/png", "text/csv", "text/html", "application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.ms-powerpoint", "application/vnd.openxmlformats-
officedocument.presentationml.presentation",
"application/vnd.openxmlformats-
officedocument.wordprocessingml.document", "text/plain"];
if (fileExt.indexOf(file.type) <= -1) {
$('input[id="Attachment"]').removeClass("valid").addClass("input-validation-error");
$('#spanAttachment').removeClass("field-validation-valid").addClass("input-validation-error red");
$('#spanAttachment').empty();
$('#spanAttachment').append("<span for='FirstName'
class=''>Filetype is not accepted.</span>");
$('#btnSubmit').attr('disabled', true);
}
答案 0 :(得分:0)
也使用那些MIME-TYPES:
application/excel
application/x-excel
application/x-msexcel