<?php
  include('../koneksi.php');                                         
 $a = mysqli_query($koneksi,"SELECT * FROM registrasi ORDER BY no DESC LIMIT 1");
                  $id = mysqli_fetch_row($a) ;
                  
              

$image = $_POST['image'];


list($type, $image) = explode(';',$image);
list(, $image) = explode(',',$image);

$image = base64_decode($image);
/*$image_name = time().'.png';*/
$image_name = "100.". sprintf("%06d",$id['0']+1).'.png';
file_put_contents('uploads/'.$image_name, $image);

echo 'successfully uploaded';
/*https://www.devopsschool.com/blog/image-upload-and-crop-using-php-and-jquery/
*/
?>