コード例 #1
0
ファイル: Client.php プロジェクト: onedaylabs/onedaylabs.com
 /**
  * Creates a file on Dropbox using the accumulated contents of the given chunked upload session.
  *
  * See <a href="https://www.dropbox.com/developers/core/docs#commit-chunked-upload">/commit_chunked_upload</a>.
  *
  * @param string $uploadId
  *                         The unique identifier for the chunked upload session.  This is obtained via
  *                         {@link chunkedUploadStart}.
  *
  * @param string $path
  *                     The Dropbox path to save the file to ($path).
  *
  * @param Dropbox_WriteMode $writeMode
  *                                     What to do if there's already a file at the given path.
  *
  * @return array|null
  *                    If <code>null</code>, it means the Dropbox server wasn't aware of the
  *                    <code>$uploadId</code> you gave it.
  *                    Otherwise, you get back the
  *                    <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata object</a>
  *                    for the newly-created file.
  *
  * @throws Dropbox_Exception
  */
 public function chunkedUploadFinish($uploadId, $path, $writeMode)
 {
     Dropbox_Checker::argStringNonEmpty("uploadId", $uploadId);
     Dropbox_Path::checkArgNonRoot("path", $path);
     Dropbox_WriteMode::checkArg("writeMode", $writeMode);
     $params = array_merge(array("upload_id" => $uploadId), $writeMode->getExtraParams());
     $response = $this->doPost($this->contentHost, $this->appendFilePath("1/commit_chunked_upload", $path), $params);
     if ($response->statusCode === 404) {
         return null;
     }
     if ($response->statusCode !== 200) {
         throw Dropbox_RequestUtil::unexpectedStatus($response);
     }
     return Dropbox_RequestUtil::parseResponseJson($response->body);
 }