Forum Moderators: coopster

Message Too Old, No Replies

trying to delete a file using unlink

         

laura2k

5:01 pm on Jun 14, 2004 (gmt 0)



hello,

i am trying to delete a file using the unlink function but it just is not working. i just get the Could not delete message. Is there anyway to find out exactly what is wrong? I've tried the exact path which is C:/domain/wwwroot/temp/0000000.txt but it just does not delete. Also i dont think it can be related to permissions because the 0000000.txt was created automatically by a script. The code i used is as follows:

<?
$delete = unlink("C:/domain/wwwroot/temp/0000000.txt");

if($delete)
{
echo "Succesfully Deleted";
}
else
{
echo "Could not Delete";
}
?>

thanx in advanced.

yowza

6:04 am on Jun 15, 2004 (gmt 0)

10+ Year Member



Create your own file and put it in the directory. Then try to do the same with that file. Do you still get the same message?

johnerazo

6:19 am on Jun 15, 2004 (gmt 0)

10+ Year Member



Also i dont think it can be related to permissions because the 0000000.txt was created automatically by a script.

Did you happen to leave the file pointer open? You must close it first via fclose($fp) before issuing unlink().