<?php

// Created by Ibrohimjon Ahmadjonov Ilhomjon o'g'li on 09.08.2023
  
$id = $_POST['id'];
$rasmi = $_POST['rasm'];
$path = "";

if(empty($rasmi)){
	$path ="";
}else{
    $path = "doc_rasm/$id.png"; 
}

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