0

I want to send an image from canvas to the server. When I send an image from postman it works. But I don't know how to send that image from canvas (HTML5). Could u help me with that? I have tried a lot of ways.

The format from the server (it's in case if I send an image from postman) click to see format

And how I use postman to send an image

canvas.getContext('2d').drawImage(video, 95, 95, 310, 310, 0, 0, 350, 350);
const request_image = canvas.toDataURL('image/png');
$.post({
    url: 'http://localhost:8088/',
    data: request_image,
    success: function (res) {
        console.log(123);
        console.log(res);
    }
});

its example how I tried to send that image. In this case server throws InvalidArgumentError: Expected image (JPEG, PNG, or GIF), got unknown format starting with 'data:image/png;b'

S.Daineko
  • 1,790
  • 1
  • 20
  • 29

0 Answers0