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)"

asked 14 May '12, 18:57

longqjl's gravatar image


Are you sure that replace() encodes your png image as base64?

var data = canvas.toDataURL('image/png');
data.replace(/^data:image\/(png|jpg);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.


answered 15 May '12, 13:19

Vasily%20Panferov's gravatar image

Vasily Panferov ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 14 May '12, 18:57

Seen: 1,861 times

Last updated: 15 May '12, 13:19

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal