var imgSelf = $("#imgSelf");
var imgUpload = $("#imgUpload");
imgUpload.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: "./Tort.aspx/SaveImg",
            data: "{ImgCoding:'" + ImgCoding + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgSelf.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})



var imgSelfs = $("#imgSelfs");
var imgUploads = $("#imgUploads");
imgUploads.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 ImgCodings = reader.result;
        $.ajax({
            type: "Post",
            url: "./Tort.aspx/SaveImgs",
            data: "{ImgCodings:'" + ImgCodings + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgSelfs.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})



var imgSelfss = $("#imgSelfss");
var imgUploadss = $("#imgUploadss");
imgUploadss.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 ImgCodingss = reader.result;
        $.ajax({
            type: "Post",
            url: "./Tort.aspx/SaveImgss",
            data: "{ImgCodingss:'" + ImgCodingss + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgSelfss.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})