Skip to content

Commit

Permalink
Rewind the provided resource before uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris White committed Feb 24, 2016
1 parent 942fbcc commit 0d9fec9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public function upload(array $options)

// Similarly, we have to use fstat to get the size of the stream.
$size = fstat($options['Body'])['size'];

// Rewind the stream before passing it to the HTTP client.
rewind($options['Body']);
} else {
// We've been given a simple string body, it's super simple to calculate the hash and size.
$hash = sha1($options['Body']);
Expand Down Expand Up @@ -430,4 +433,4 @@ protected function getFileIdFromBucketAndFileName($bucketName, $fileName)

return null;
}
}
}

0 comments on commit 0d9fec9

Please sign in to comment.