Page 1 of 1

Deleting a file

Posted: Tue May 18, 2004 12:42 am
by binjured
Maybe I am missing something simple here, but unlink($file) isn't working for deleting files. Where do a specify a directory here? This is for an upload script... people can upload files to a dir, it puts the file name into a mysql DB, they can then delete the file. It properly removes the respective name from the mysql DB when doing this, but how can the actual FILE be deleted? I'm sure i'm missing something simple. Thanks.

Posted: Tue May 18, 2004 2:27 am
by markl999
unlink('/the/full/path/to/'.$filename);

Posted: Tue May 18, 2004 2:33 pm
by qads
one thing you may want to make sure is that after coping te file after upload, use chmod(filepath, 0777); on the file (if its on linux server), if you dont, you wont be able to delete it :).