php is getting image in following format, while echoing $_POST['img']
http://localhost/uploads/images/1533033949-8.jpg
But why unlink doesn't working -
// Get src.
$img = $_POST["img"];
// Check if file exists.
if (file_exists(getcwd() . $img)) {
// Delete file.
unlink(getcwd() . $img);
echo "Deleted";
}
I tried testing directly, but doesn't work
unlink($img)