PDA

View Full Version : unlink file



darekw1
04-16-2008, 06:51 AM
I'm trying to delete files from my directory but have problems.
I assume it has something to do with permission but not sure.
Here is the code:

$file = unlink("/index.html");
if (! unlink ($file)) {
echo ("Couldn't delete file");
} else {
echo ("Removed $filepath");

Please advise where I go wrong.

darekw1
04-16-2008, 08:51 AM
Ok got it solved !
code design very slappy it should have been:

<?
$file ="/home/***/public_html/upload/windcomponent.jpg";
if (! unlink ($file)) {
echo ("Couldn't delete file");
} else {
echo ("Removed $filepath");
}
?>
So I was deleting twice and thats why error was generated that no such file exist.

Thank you once again for all the profesional help you provide here !
You are the best !
;-)