<?php

// Created by Ibrohimjon Ahmadjonov Ilhomjon o'g'li on 11.11.2022
  
$id = $_POST['id'];
$rasmi = $_POST['rasm'];
 $path = "";
if(empty($rasmi)){
	$path ="";
}else{
    $path = "img/$id.png"; 
}

if(file_exists($path)) {
    unlink($path); 
} 
  
if(!empty($rasmi)){
    file_put_contents($path,base64_decode($rasmi));
    echo 'ok';
} else{
    echo 'no_c';
}
 
?>