<?php

$delXML = $_POST['delXML'];
$userName = $_POST['userName'];
$path = "../shapeDetect/".$userName."/myCustomXML/".$delXML;

$response = "";

function deleteXMLfile() {
    global $path;
        if (file_exists($path)){
            unlink($path);
        }
}

deleteXMLfile();

if (!file_exists($path)) {
    $response = "File deleted successfully";
} else {
    $response = "File not deleted";
}

echo $response;

?>