function upload(obj) {
var filePath = "";
var fileType = "";
var fileName = $(obj).val().split('\\');
console.log()
fileName2 = fileName[fileName.length - 1]; // 获得文件名
console.log(fileName2);
var fileSize = obj.files[0]; //获得文件大小;
console.log(fileSize.size);
filePath = $(obj).val().toLowerCase().split(".");
fileType = filePath[filePath.length - 1]; //获得文件结尾的类型
console.log(fileType);
if (!(fileType == "png" || fileType == "jpg" || fileType == "xlsx" || fileType == "docx" || fileType == "rar" ||
fileType == "zip")) {
alert('文件格式不符合要求!')
} else if (fileSize.size > 10485760) {
alert('错误!请上传不超过10M的文件');
return
} else {
alert("上传成功!");
}
}