Jump to content


Photo

Deleting an image from a directory folder?


  • Please log in to reply
5 replies to this topic

#1 Solarpitch

Solarpitch
  • Members
  • PipPipPip
  • Advanced Member
  • 708 posts
  • LocationDublin, Ireland

Posted 19 October 2006 - 08:01 AM

Hey Guys,

Ok . . I finally got saving a image to a file on the server, storing the path in the table and calling the path to display the image on the web page, sorted out!

Thats all good and well . . . but how do I go about deleting the image from the folder in an application? Sure the image path from the database can be deleted easy . . but how do you get it to effect the folder on the server that holds the image?

EG: If a user click delete image . . it deletes the path in the database and the file in the directory?

Thanks in advance!
Welcome to 9AM Monday, the furthest point away from 5PM Friday.

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 19 October 2006 - 08:04 AM

Use the unlink function :)

#3 Solarpitch

Solarpitch
  • Members
  • PipPipPip
  • Advanced Member
  • 708 posts
  • LocationDublin, Ireland

Posted 19 October 2006 - 08:17 AM

Thanks . . I'll check that link out in a bit!
Welcome to 9AM Monday, the furthest point away from 5PM Friday.

#4 Solarpitch

Solarpitch
  • Members
  • PipPipPip
  • Advanced Member
  • 708 posts
  • LocationDublin, Ireland

Posted 19 October 2006 - 10:26 AM

Sorry . . but that link did not help at all.  Anyone any ideas?
Welcome to 9AM Monday, the furthest point away from 5PM Friday.

#5 xsist10

xsist10
  • Members
  • PipPipPip
  • Advanced Member
  • 114 posts

Posted 19 October 2006 - 10:34 AM

The file you want to delete must have specific permissions on it. The web server (apache, etc) must have permission to delete that file...


try this on the file (in your linux console) before you attempt to unlink / delete it

chmod 755 {file_name}
chown www-data:www-data {file_name}

or

chmod 755 {file_name}
chown www:www {file_name}
SA PHP Archives - www.phparchives.za.org

#6 Solarpitch

Solarpitch
  • Members
  • PipPipPip
  • Advanced Member
  • 708 posts
  • LocationDublin, Ireland

Posted 19 October 2006 - 10:36 AM

I'll give that a try later . . thanks!
Welcome to 9AM Monday, the furthest point away from 5PM Friday.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users