-3

I am trying to find a way of allowing users on my site to delete certain images in a folder where the 'photo/image id' = $_SESSION['user_id']

Is there a script out there that I can use to do this? I would really be grateful if someone could show me what I'd need to do or point me in the right direction.

I'm looking for something where the photos would be echo'ed out and beside the photo would be a delete button or something similar, the user can then click for each photo and it will be deleted from a folder where the image folder directory = the $_session['user_id'] and where that photo = the photo id or something.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
James Pale
  • 193
  • 3
  • 6
  • 18

3 Answers3

7

Lookup glob() and unlink(). These can help you.

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
0

File delete with PHP

Make sure you have the right permissions in the folder.

Osmoz
  • 29
  • 5
0

to delete files you should use

if('photo/image id' == $_SESSION['user_id'])
 unlink(path_to_file);
tcgumus
  • 328
  • 3
  • 8