/** * Delete file from cloud hosting * $containerName = 'img_albums'; * $cloudFileName = 'banner.jpg'; * * @author Oleg D. */ function deleteFromCloudHosting($containerName, $cloudFileName) { include_once '../vendors/rackspace_cloudfiles/cloudfiles.php'; // Connect to Rackspace $Auth = new CF_Authentication(RACKSPACE_CLOUDFILE_USERNAME, RACKSPACE_CLOUDFILE_APIKEY); $Auth->authenticate(); $Connection = new CF_Connection($Auth); // Get the container we want to use $Container = $Connection->get_container($containerName); // check for exists file $CheckExistObject = new CF_Object($Container, $cloudFileName); if (!$CheckExistObject->exists()) { return false; } // delete file return $Container->delete_object($cloudFileName); }