简体   繁体   中英

Posting Base64 Image Data via Ajax - Data Truncating

I am attempting to send Base64 image data via ajax to Server. Sometimes all the pics make it, other times only aa few make it.

Any ideas for error checking that all the data is received by the server?

http.open("post", URL, true);

http.onreadystatechange =   function()
{ 
     if(http.readyState  == 4)
     {
          if(http.status  == 200) {
              alert(http.responseText);
          alert("eReport Successfully sent to Server " + CustID +" "+name +" "+ListType);
          //clearCurrentReport();
          removeReport(CustID, ListType);
          } 


           //   alert("Received:"  + http.responseText); 
          else 
             alert("Report NOT SENT. Error Communicating with Server.  Please try again when you have a connection." );
     }
}; 

params = custid="+CustID+"&photo1="+pic1+"&photo2="+pic2+"&photo3="+pic3+"&photo4="+pic4+"&photo5="+pic5+"&photo6="+pic6;

http.send(params);

A possible problem is the amount of data you are sending. The server has a limit for the data, that can be sent at once. And php ( if you are using php ) has such a limit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM