<?php
session_start()
  include('../koneksi.php');                                         
 $a = mysqli_query($koneksi,"SELECT * FROM user ORDER BY id DESC LIMIT 1");
                  $id = mysqli_fetch_row($a) ;
                  /*echo $id['0'];*/
              

$image = $_POST['image'];


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

$image = base64_decode($image);
/*$image_name = time().'.png';*/
$image_name = $id['3'].'.png';
file_put_contents('uploads/'.$image_name, $image);

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