weixin_33691700 2017-10-19 09:53 采纳率: 0%
浏览 450

通过ajax发送base64图像

I need to send an image base64 encoded to an API. My json out put got only 10000 characters from the base64 code.

    var data = new Object(); 
    data.image= $('#image').val();
    data.date = new Date($.now()); 
    console.log(JSON.stringify(data));
    $.ajax({
        type: "POST",
        url:  app.url
        data: JSON.stringify(data),
        contentType: "application/json",
        crossDomain: true,
        xhrFields: {
            withCredentials: true
        },
        dataType: "json",
        success: function (data, status, jqXHR) {
        },
        error: function (jqXHR, status) { 
        }
    });

In my console.log i've got the full string, but not in the request.

Thanks

  • 写回答

2条回答 默认 最新

  • weixin_33690367 2017-10-19 10:09
    关注

    You would need to increase your server php.ini upload_max_filesize and post_max_size or you can try this solution Upload base64 image with Ajax

    评论

报告相同问题?