I'm trying to delete a file on the server. Below is the code I use.
function ServerDel($file){
$file = realpath($file);
echo ($file);
$fh = fopen($file, 'w') or die("can't open file");
fclose($fh);
if(unlink($file))
echo"Delete the file successfully.";
else
echo "Failed to delete.";
}
But after I run the code, the file still exists and becomes 0KB. Anyone knows how to get around this?
Thanks in advance.