-
判断文件的大小:
-
var size = fileSize / 1024;
-
if(size>10000){
-
alert("附件不能大于10M");
-
}
-
-
判断文件格式:
var index1=this.ImpForm.name.toLowerCase().split('.').splice(-1);
if("xls" != index1 && "xlsx" != index1 ){}
本文介绍了如何使用JavaScript代码来检查上传文件的大小是否超过10MB限制,并验证文件格式是否为.xls或.xlsx。这对于确保文件符合特定的上传标准至关重要。
判断文件的大小:
var size = fileSize / 1024;
if(size>10000){
alert("附件不能大于10M");
}
判断文件格式:
var index1=this.ImpForm.name.toLowerCase().split('.').splice(-1);
if("xls" != index1 && "xlsx" != index1 ){}
1914

被折叠的 条评论
为什么被折叠?