After converting my canvas to a an image source using
canvas.toDataURL(\"image/png\");
and passing it to a php file, how do I save it as
It's actually very simple, if you have allow-url-fopen enabled. PHP supports the data:
URL scheme then, and automatically decodes base64 and urlencoding.
preg_match('#^data:[\w/]+(;[\w=]+)*,[\w+/=%]+$#', $data=$_POST["dataU"])
and
copy($data, "output.png");
But you could also just extract the part after the ,
and manually base64_decode() it.