public function addObject($bucketName, $objectName, $contentFile, array $requestHeaders = null)
{
$options = array('_subdomain' => (string) $bucketName);
$allowedRequestHeaders = array('Cache-Control', 'Content-Disposition', 'Content-Encoding', 'Content-Length', 'Content-MD5', 'Content-Type', 'Expect', 'Expires', 'x-amz-meta-', 'x-amz-server-side-encryption', 'x-amz-storage-class', 'x-amz-website-redirect-location');
if (!empty($requestHeaders)) {
$requestHeaders = $this->getFilteredArray(array_merge($allowedRequestHeaders, self::$xamzAclAllowedHeaders), $requestHeaders);
$options = array_merge($options, $requestHeaders);
}
if ($contentFile instanceof \SplFileInfo) {
if (!$contentFile->isFile()) {
throw new S3Exception(sprintf('File "%s" does not exist', $contentFile->getPathname()));
}
$options['_putFile'] = $contentFile->getPathname();
} else {
$options['_putData'] = $contentFile;
}
$response = $this->client->call('PUT', $options, sprintf('/%s', self::escapeObjectName($objectName)));
return $response->getError() ?: $response;
}