/** * Store an item in the storage service. * * @param string $destinationPath * @param mixed $data * @param array $options * @return void */ public function storeItem($destinationPath, $data, $options = null) { $this->_rackspace->storeObject($this->_container, $destinationPath, $data, $options); if (!$this->_rackspace->isSuccessful()) { throw new Zend_Cloud_StorageService_Exception('Error on store: ' . $this->_rackspace->getErrorMsg()); } }
/** * Save a file into a container. * * @param string $tempFilePath * @param string $name * @param array $metadata * @return boolean */ public function saveFile($tempFilePath, $name, $metadata = array(), $contentType = null, $clientId = false) { if ($clientId) { $this->setClientId($clientId); } if (!file_exists($tempFilePath)) { return false; } $file = file_get_contents($tempFilePath); $container = $this->getGeneralContainer(); $this->deleteObject($name, $container); $this->_service->storeObject($container, $name, $file, $metadata, $contentType); if (!$this->_service->isSuccessful()) { throw new Exception('Storing ' . $name . ' into container ' . $container . ' failed: ' . $this->_service->getErrorMsg()); return false; } return true; }
public function testStoreObject() { $content = 'This is a test!'; $result = $this->rackspace->storeObject(TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME, TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME, $content, $this->metadata); $this->assertTrue($result); }
public function testStoreObject() { $content = 'This is a test!'; $result = $this->rackspace->storeObject('zf-unit-test', 'zf-object-test', $content, $this->metadata); $this->assertTrue($result); }