akonsu
akonsu

Reputation: 29576

need to upload the contents of HTML5 canvas

I have HTML5 canvas where the user has created an image. This is for an image drawing program. I now need to grab the canvas and post it to my server. I also need to post a set of key/value pairs along with the image. Could someone help me with how this is supposed to be done?

Upvotes: 1

Views: 258

Answers (1)

apsillers
apsillers

Reputation: 116000

See Capture HTML Canvas as gif/jpg/png/pdf? for how to use toDataURL to turn your canvas into an image (encoded as a data URL) .

Consult the MDN Ajax tutorial to learn how to send data to your server asynchronously.

Upvotes: 1

Related Questions