I am trying to create an image using DataURL of a Canvas (using JavaScript). When a user hits submit, the value gets sent to an Input type text tag (e.g., <input type='text'>
), however, apparently on Chrome, the text gets cut off when it is at length 524,288 characters.
I am sending it to an input tag because I need to obtain the value in PHP (as a $_POST['dataurltext'];), so that I can create an image and upload it to my web server.
Any ideas on how to bypass this length?
Should I use a comment box instead, maybe?
Thank you for any help, it will be greatly appreciated.
Try sending
canvas
asBlob
atjavascript
; usefopen()
withphp://input
as parameter to readBlob
,stream_copy_to_stream
orfile_get_contents()
,file_put_contents()
to process file atphp
See
HTMLCanvasElement.toBlob()
Beyond $_POST, $_GET and $_FILE: Working with Blob in JavaScript and PHP