Sunday, 15 September 2013

javascript - passing canvas image to php -



javascript - passing canvas image to php -

i'm going upload canvas image mysql. using php, before that, how can pass canvasdata php. i've done searching, of solution complicated me. that's why decide post question on here. i'm doing in localhost environment.

there capture button when click on it, activate function. capture canvas photo.

function() { context.drawimage(video, 0, 0, 300, 200); var canvasdata = canvas.todataurl("image/png"); }

as know right canvasdata variable base64 code.

what best solution me pass info php me upload database. give thanks in advance.

js side:

context.drawimage(video, 0, 0, 300, 200); var canvasdata = canvas.todataurl("image/png"), xhr = new xmlhttprequest(); xhr.open('post', url, true); xhr.onload = function() { alert('hooray! uploaded.'); } xhr.send(canvasdata);

php side illustration can take here get image base64 string

javascript php html5 canvas

No comments:

Post a Comment