2017-10-19 118 views
0

我需要将图像base64编码发送到API。 我的json输出从base64代码只有10000个字符。通过ajax发送base64图像

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) { 
     } 
    }); 

在我的console.log我有完整的字符串,但没有在请求中。

感谢

回答

0

这是仅限于10000字符

只是铬控制台/网络显示
0

您将需要增加服务器的php.ini upload_max_filesizepost_max_size或者你可以尝试这种解决方案 Upload base64 image with Ajax

+0

这只是铬控制台/网络显示器限于10000个字符 –