Jump to content

Deleting an image from a directory folder?


Solarpitch

Recommended Posts

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!
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}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.