if (file_exists(MEDIA_FILES_PATH . "sponsor/" . $sponsorLogo) && $sponsorLogo != '') { if (unlink(MEDIA_FILES_PATH . "sponsor/" . $sponsorLogo)) { $logoDelParam = true; } else { $logoDelParam = false; } } if (file_exists(MEDIA_FILES_PATH . "sponsor-image/" . $sponsorImage) && $sponsorImage != '') { if (unlink(MEDIA_FILES_PATH . "sponsor-image/" . $sponsorImage)) { $logoDelParam = true; } else { $logoDelParam = false; } } if ($logoDelParam == true) { echo $sponsorObj->delete(); } else { $json = array("status" => 0, "msg" => $errorArr); $dbObj->close(); //Close Database Connection header('Content-type: application/json'); echo json_encode($json); } } else { $json = array("status" => 0, "msg" => $errorArr); $dbObj->close(); //Close Database Connection header('Content-type: application/json'); echo json_encode($json); } }