Forum Moderators: coopster

Message Too Old, No Replies

Deleting files with php

         

michlcamp

4:35 pm on Nov 9, 2005 (gmt 0)

10+ Year Member



Is there a way to delete a file within a directory using a link?

I have a script that will list all the files in a directory and, in the output, I'd like to create a link next to each file that says "Delete This file" and then will delete the file from the /dir

filename1.jpg Delete File [d.com]
filename2.jpg Delete File [d.com]
filename3.jpg Delete File [d.com]
filename4.jpg Delete File [d.com]

Any help appreciated.
Thanks in advance.
mc

jatar_k

4:43 pm on Nov 9, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could have the link go to a script that will take the filename and then use unlink()

permissions is often where deleting falls on it's face.

I also hope this isn't a publicly available function or it could be used for much mischief