Some programmer using image upload coding that image file move on particular folder. after delete that database record data only deleteed but image stay on same folder only it's not delete. So add below code remove deleted record folder image.
unlink('foldername/'.$imagename);
Sample code
$Q2="SELECT * FROM image WHERE id='".$id."'";
$row2 = dbRow($Q2);
$image_path=$row2['image'];
if(file_exists('imagesfolder/'.$image_path))unlink('imagesfolder/'.$image_path);
unlink('foldername/'.$imagename);
Sample code
$Q2="SELECT * FROM image WHERE id='".$id."'";
$row2 = dbRow($Q2);
$image_path=$row2['image'];
if(file_exists('imagesfolder/'.$image_path))unlink('imagesfolder/'.$image_path);
0 comments:
Post a Comment