Skip to content

Commit

Permalink
Reinstate upload request. Append error message to VimeoUploadException.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenya S committed May 11, 2015
1 parent 87f11a0 commit 270f3fc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Vimeo/Vimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ private function perform_upload($file_path, $ticket)
$curl_opts[CURLOPT_HTTPHEADER][] = 'Content-Range: bytes ' . $server_at . '-' . $size . '/' . $size;

fseek($file, $server_at); // Put the FP at the point where the server is.
$this->_request($url, $curl_opts); //Send what we can.
$progress_check = $this->_request($url, $curl_opts_check_progress); // Check on what the server has.

// Figure out how much is on the server.
Expand All @@ -402,11 +403,12 @@ private function perform_upload($file_path, $ticket)

// Complete the upload on the server.
$completion = $this->request($ticket['body']['complete_uri'], array(), 'DELETE');

// Validate that we got back 201 Created
$status = (int) $completion['status'];
if ($status != 201) {
throw new VimeoUploadException('Error completing the upload.');
$error = !empty($completion['body']['error']) ? '[' . $completion['body']['error'] . ']' : '';
throw new VimeoUploadException('Error completing the upload.'. $error);
}

// Furnish the location for the new clip in the API via the Location header.
Expand Down

0 comments on commit 270f3fc

Please sign in to comment.