//上传文件时对文件类型做一个验证
$("#myfile").on("change", function () {
var a = document.getElementById("myfile").files[0].type.split("/");
if (a[0] != "image") {
alert("必须是图片类型,否则不允许上传!");
window.location.href = "/AdImage/Index";
return;
}
});