Page 1 of 1
delete file
Posted: Tue Jul 08, 2003 7:40 am
by irealms
i want a user to be able to press a link that deletes a record from a database and a file at the same time. I know how to delete from a database but how do i delete a file from the directory?
Posted: Tue Jul 08, 2003 8:20 am
by DuFF
I could give you an easy example but it'll be better for you if you do it yourself

. Check out:
http://us2.php.net/unlink. If you need it, $_SERVER['DOCUMENT_ROOT'] will start the path to the file at the root directory.
Posted: Tue Jul 08, 2003 8:32 am
by irealms
ok thanks , so something like :
int unlink ('uploads/'.$_GET[remove].'');
where the $_GET is the filename i want to delete
Posted: Tue Jul 08, 2003 8:48 am
by DuFF
Yeah that should work. Though I'm not sure why you have "int" at the beggining of the line.
Posted: Tue Jul 08, 2003 9:03 am
by irealms
works great thanks
