PHP Data-URI to file

A quick look at the PHP manual yields the following:

If you want to save data that is derived from a Javascript
canvas.toDataURL() function, you have to convert blanks into plusses.
If you do not do that, the decoded data is corrupted:

$encodedData = str_replace(' ','+',$encodedData);
$decodedData = base64_decode($encodedData);

Leave a Comment