2017-10-19 124 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個字符 –