Valhalla Legends Forums Archive | Web Development | PHP: Problems deleting files using unlink

HolyoneOkay, I'm working on an intranet site and I want to delete TMP files automatically. The script to find the .tmp files works fine, but I'm having problems with unlink($filename). The directory of all the php pages is \\servername\wwwroot\links\blah.php and all the .tmp files are in this same directory. I've tried many variations of the file paths and what not to delete the file (Named: TMP19D.tmp), but nothing seems to work. Here's some of the code that I tried:

$filename = "TMP19D.tmp";

I tried using the full directory

$filename = "/wwwroot/links/TMP19D.tmp";

That doesn't work, I tried http://servername/links/TMP19D.tmp.

I also tried adding the line chmod($filename, 0777); before the unlink statement, but that doesn't work either.

System has full permissions. I have rights to delete files along with everyone else. Since it's an intranet site, security isn't really an issue, so I'm now worried about people having full permissions. However, if anyone has any suggestions or anything I'd really appreciate it, thanks.
June 28, 2005, 10:27 am
WarriorDoes the folder containing the file also have 777?June 28, 2005, 11:01 am
HolyoneYa, I set permissions for the entire folder itself. June 28, 2005, 12:01 pm
WarriorCheck what directory you are in try a is_dir() on the file just to check it out, might reveal something. June 28, 2005, 05:38 pm
Arta[vL]If you're using a relative path, check the working directory (getcwd/chdir). If you're using an absolute path, make sure it is correct - that is the path from the root of the drive, not the path on the webserver. You may have done this already, but make sure the file to be deleted and the directory it is in have write permissions. June 28, 2005, 07:15 pm
JTN DesignerNo need for delete($filename); when unlink(); already does that.June 28, 2005, 10:43 pm