Uploading 'canvas' image data to the server

canvas, html, javascript

Solution

You don't need a file input, just get the data with `ctx.getImageData()` and post it to the server with Ajax.

See the MDN Documentation for `CanvasRenderingContext2D.getImageData()`.

But you won't be able to get the image data in IE, even with `ExCanvas`.

Problem

I need to upload the canvas image data to the server (database) on the fly, i.e., I need to create a form and with an input=file, and post the image data without any user interaction.

Original source