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

longqjl
12


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.

link

answered 15 May '12, 13:19

Vasily%20Panferov's gravatar image

Vasily Panferov ♦♦
5422516

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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

Tags:

×9

Asked: 14 May '12, 18:57

Seen: 1,818 times

Last updated: 15 May '12, 13:19

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