How to download canvas image into database code example
Example: How to download canvas image into database
//ajax;;;;;;;;;;
save.click((e)=>{
var data = canvas.toDataURL('image/png');
$.post('save.php',{'img':data},function(e){
console.log(e);
})
})
//php
<?php
$data = $_POST['img'];
$file = "data/file.png"; // where you want to upload, file path;;;;;
$uri = substr($data,strpos($data, ",") + 1);
file_put_contents($file, base64_decode($uri));
echo $file;
?>