1.js代码
.function handleFiles(target,id) { var isIE = /msie/i.test(navigator.userAgent) && !window.opera; var fileSize = 0; if (isIE && !target.files) { var filePath = target.value; var fileSystem = new ActiveXObject("Scripting.FileSystemObject"); var file = fileSystem.GetFile (filePath); fileSize = file.Size; } else { fileSize = target.files[0].size; } var size = fileSize / 1024; if(size>512){ $('#'+id).replaceWith($('#'+id).clone()); alert("附件不能大于512k"); } }
2.修改浏览器安全设置
工具---->internet选项----->安全----->自定义级别 ------启用 activeX控件