<script type="text/javascript">
function check() {
var fileName = $("#AddFiles_myFile").val().trim();
if (fileName == '') {
alert("请选择要上传的文件");
return false;
}
if (fileName.indexOf('#') >= 0) {
alert('文件名中不能有井号');
return false;
}
if (fileName.indexOf('+') >= 0) {
alert('文件名中不能有加号');
return false;
}
if (fileName.indexOf(' ') >= 0) {
alert('文件名中不能有空格');
return false;
}
var reg = /(\.zip|\.rar|\.js|\.css|\.xml|\.7z|\.ico|\.pdf|\.ppt|\.pptx|\.xap|\.xpi|\.swf|\.apk|\.cdf)$/ig;
if (!reg.test(fileName)) {
var supportType = reg.toString().replace(/\/|\(|\)|\\|/ig, '');
supportType = supportType.substring(0, supportType.length - 3);
supportType = supportType.replace(/\|/g, ' ');
alert('不支持该上传文件类型!\n支持的文件类型:' + supportType);
return false;
}
return true;
}
</script>