I have an svg file that is generating a dataURI-png and that works great. And I want that dataURI to be saved as an image, therefore I try to send the dataURI through ajax t
You can use canvas.toBlob(), send image to php
as a Blob
, use php://input to read Blob
at php
, see Beyond $_POST, $_GET and $_FILE: Working with Blob in JavaScript and PHP
javascript
if (!HTMLCanvasElement.prototype.toBlob) {
Object.defineProperty(HTMLCanvasElement.prototype, "toBlob", {
value: function (callback, type, quality) {
var binStr = atob( this.toDataURL(type, quality).split(",")[1] ),
len = binStr.length,
arr = new Uint8Array(len);
for (var i=0; i
readBlobInput.php