I use XMLHttpRequest to post a png file captured by canvas.
var xhr = new XMLHttpRequest();
xhr.send(canvas.toDataURL('image/png').replace(/^data:image\/(png|jpg);base64,/, ""));
But the server replies me by "551 (Unsupported image file format)"
I use XMLHttpRequest to post a png file captured by canvas.
var xhr = new XMLHttpRequest();
xhr.send(canvas.toDataURL('image/png').replace(/^data:image\/(png|jpg);base64,/, ""));
But the server replies me by "551 (Unsupported image file format)"
0 out of 0 found this helpful
Comments
1 comment
Are you sure that replace() encodes your png image as base64?
Also, it seems you are doing cross-domain XMLHttpRequest from within a browser. Take a look here. If you succeed in your task, let us know so we can add html/javascript sample to our samples repository.
Please sign in to leave a comment.