function removeOfferImage() { $offerId = $_REQUEST['offerId']; $file = $_REQUEST['image']; $file_path = DOC_ROOT . 'uploads/special_offers/' . $file; $offers = new Offers(); if (file_exists($file_path)) { if (unlink($file_path)) { $offers->setId($_REQUEST['offerId']); $offers->deleteImage(); Common::jsonSuccess("Offer image deleted successfully"); } else { Common::jsonError("Failed to delete"); } } else { Common::jsonError("Error"); } }