i have a script that creates a temp file that needs to be deleted when the script finishes.
the file path(including file name) is in a variable $tempfilepath
for UNIX systems, I have:
@$mod= chmod($tempfilepath, 0646);
if (!$mod)
{
echo "Couldn't modify temp file permissions!";
die();
}
@$unlink= unlink($tempfilepath);
if (!$unlink)
{
@$unlink= system("del $tempfilepath ");
if (!$unlink)
{
echo "<br>Couldn't delete file<br>";
}
}
then where it deletes, if there is an error using the unlink() function, i revert to the system() command,
i just tried it on my computer and it returns my error: "couldn't delete file"
so how do I go about deleting files correctly both on UNIX and in Windows(2000 or XP)