var isIE = /msie/i.test(navigator.userAgent) && !window.opera;
function fileChange(target, typeFile) {
var name = target.name;
var files = $('input[name="' + name + '"]').prop('files');
var fileSize = 0;
var filetypes = "";
if (typeFile == 1) {
filetypes = [".doc", ".docx", ".wps"];
} else {
filetypes = [".pdf"];
}
var filepath = target.value;
var fileid = target.id;
var fileheml = document.getElementById(fileid);
var filemaxsize = 1024 * 200;//2M
if (filepath) {
var isnext = false;
var fileend = filepath.substring(filepath.lastIndexOf("."));
if (filetypes && filetypes.length > 0) {
验证input file文本框上传文件时验证文件格式及文件内容大小
最新推荐文章于 2024-07-26 10:02:33 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)