Solarpitch Posted October 19, 2006 Share Posted October 19, 2006 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! Link to comment https://forums.phpfreaks.com/topic/24414-deleting-an-image-from-a-directory-folder/ Share on other sites More sharing options...
Daniel0 Posted October 19, 2006 Share Posted October 19, 2006 Use the [url=http://php.net]unlink[/url] function :) Link to comment https://forums.phpfreaks.com/topic/24414-deleting-an-image-from-a-directory-folder/#findComment-111099 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 Thanks . . I'll check that link out in a bit! Link to comment https://forums.phpfreaks.com/topic/24414-deleting-an-image-from-a-directory-folder/#findComment-111108 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 Sorry . . but that link did not help at all. Anyone any ideas? Link to comment https://forums.phpfreaks.com/topic/24414-deleting-an-image-from-a-directory-folder/#findComment-111140 Share on other sites More sharing options...
xsist10 Posted October 19, 2006 Share Posted October 19, 2006 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 itchmod 755 {file_name}chown www-data:www-data {file_name}orchmod 755 {file_name}chown www:www {file_name} Link to comment https://forums.phpfreaks.com/topic/24414-deleting-an-image-from-a-directory-folder/#findComment-111142 Share on other sites More sharing options...
Solarpitch Posted October 19, 2006 Author Share Posted October 19, 2006 I'll give that a try later . . thanks! Link to comment https://forums.phpfreaks.com/topic/24414-deleting-an-image-from-a-directory-folder/#findComment-111143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.