How to get image folder -> subfolder name -> from MySQL URL:
images/5d049d4ac96e6/image.jpg
and delete it with all content.
At the moment code delete image.jpg
file only from image subdirectory but what I need is to delete also subfolder /5d049d4ac96e6/
$stmt = $db->prepare('SELECT postImage FROM blog_posts_seo WHERE postID = :postID') ;
$stmt->execute(array(':postID' => $_GET['delpost']));
while($row = $stmt->fetch()){
$delImage = dirname(__FILE__, 2) . '/'.$row['postImage'];
unlink($delImage);
//rmdir(?????);
}
How to extract this part of mysql url: /5d049d4ac96e6/