//Verify the format of the file
function validateFile(){
var fileObject=$("#filename");
var errorObject=$("#error");
var filepath=fileObject.val();
var fileArr=filepath.split(" //");
var fileTArr=fileArr[fileArr.length-1].toLowerCase().split(".");
var filetype=fileTArr[fileTArr.length-1];
if (filetype!="xls"&&filetype!="xlsx"&&filetype!="doc"&&filetype!="docx"
&&filetype!="jpeg"&&filetype!="jpg"&&filetype!="ppt"&&filetype!=" pptx"
&&filetype!="txt"&&filetype!="bmp"&&filetype!="png"&&filetype!="gif"){
fileObject.focus();
errorObject.html("Upload file Must be a picture, doc, ppt, xls, txt file! ");
}else{
errorObject.remove();
}
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn