Page 1 of 1

Click a link, Delete a File

Posted: Mon Mar 13, 2006 12:49 am
by VKX
I would like to be able to click a link that's automatically generated for me, and have it delete a file. The link would probably call a php page that would feed the filename into a function I'm assuming. What kind of function would I need to create to do that?

Posted: Mon Mar 13, 2006 12:52 am
by John Cartwright
create a list of files using opendir() and readdir(). Then pass the filename as a $_GET parameter along withfile_exists() to make sure the file exists before using unlink() to delete the file