/** * Create an object from a path * @param string $objectPath * @param string $name * @param string $content * @return boolean|string */ public function createObject($objectPath, $name, $content) { $success = false; $path = $this->getPath($objectPath); $tempPath = $this->xpdo->getOption(xPDO::OPT_CACHE_PATH) . 'dropbox/' . uniqid() . '/'; if (!file_exists($tempPath)) { $this->xpdo->cacheManager->writeTree($tempPath); } $fileName = $tempPath . $name; if (!$this->xpdo->cacheManager->writeFile($fileName, $content)) { $this->addError('file', $this->xpdo->lexicon('file_err_create')); return false; } $response = null; try { # $response = $this->getClient()->putFile($container, $fileName); $f = fopen($fileName, "rb"); $response = $this->getClient()->uploadFile($path . '/' . $name, dbx\WriteMode::add(), $f); fclose($f); } catch (Exception $e) { $error = $this->lexicon('uploadObjectsToContainer', array('path' => $path, 'message' => $e->getMessage()), 'error'); $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, $error); $this->addError('file', $error); return $success; } @unlink($fileName); if ($response) { $success = true; } # # die('public function createObject'); return $success; }