0

Here my jquery code:

var image = document.getElementById("canvas").toDataURL("image/png");
$.ajax({
type: "POST",
url: "imageup.php",
data: {image:image, title:getTitle, infos:informations},
success: function (response) {
alert(response);
}
});

For small images this work perfectly, but when i use a larg image, i odn't get the full base64 code of the image itself !

I tried this solution here:

https://stackoverflow.com/a/5061163/7232957

I devided the base64 image into many part and add them into array, and then send it to server side ! but all time same thing ! not get the full image.

Any one have a trick in order to solve this annoying problem ?

Is there a way to send html5 canvas image as file to server side ?

I already configured my apache server:

post_max_size = 500 Mo
upload_max_filesize = 500 Mo
Community
  • 1
  • 1
Jis Maxi
  • 226
  • 1
  • 4
  • 16
  • Try sending a blob instead of a dataURL http://stackoverflow.com/questions/34711715/phpjs-how-to-do-fileuploads-in-html-form-as-content-type-multipart-via-js/34713226#34713226 – Kaiido Dec 12 '16 at 00:40
  • @Kaiido i have to post other informations with the canvas image like: title, description etc ... this method upload only the file. (I need the file as base64 encode in the php script). – Jis Maxi Dec 12 '16 at 00:46
  • maybe your script is timing out too soon? – JoeCrash Dec 12 '16 at 00:53
  • @Conceptz Unfortunately no `ini_set ('max_execution_time', 0);` – Jis Maxi Dec 12 '16 at 00:58
  • No, this method allows you to send anything along with the file, but sends the file as multi-part, which is the way to send files. If you need a dataURL version server side (I wonder why?) then do the conversion server side. – Kaiido Dec 12 '16 at 00:59
  • @Kaiido just tested it but it seem there a problem with base64 encoded image ! when i save the image directly this one work well, but when i encode it with base64 and show it with , he don't work ! the problem do not come from the script it self but from the encoded image. Do you have idea about this ? – Jis Maxi Dec 12 '16 at 01:33
  • Without seeing how you do encode it, nor how you do store the encoded stringn nor how you retrieve it nor the actual output, nope, I don't have an idea – Kaiido Dec 12 '16 at 09:48

0 Answers0