var img = $("#img");
var fuImg = $("#fuImg");
fuImg.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCoding = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_Logo.aspx/SaveImg",
            data: "{ImgCoding:'" + ImgCoding + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    img.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})



var imgico = $("#img-ico");
var fuimgico = $("#fuImg-ico");
fuimgico.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodingico = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_Logo.aspx/SaveImgico",
            data: "{ImgCodingico:'" + ImgCodingico + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgico.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})






var imgm = $("#img-m");
var fuimgm = $("#fuImg-m");
fuimgm.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodingm = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_Logo.aspx/SaveImgm",
            data: "{ImgCodingm:'" + ImgCodingm + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgm.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})