From c84c5a8d16e01d768bbd862087f5715b4a77bba4 Mon Sep 17 00:00:00 2001 From: Derek Myers Date: Tue, 6 May 2014 01:28:44 -0500 Subject: [PATCH] Added setting content type for amazon s3 adapter for upload method --- src/Dmyers/Storage/Adapter/AmazonS3.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Dmyers/Storage/Adapter/AmazonS3.php b/src/Dmyers/Storage/Adapter/AmazonS3.php index 4ec96a9..2bdb276 100644 --- a/src/Dmyers/Storage/Adapter/AmazonS3.php +++ b/src/Dmyers/Storage/Adapter/AmazonS3.php @@ -72,11 +72,14 @@ public function put($path, $contents) */ public function upload($path, $target) { + $finfo = new \Finfo(FILEINFO_MIME_TYPE); + return $this->client->putObject(array( - 'Bucket' => $this->bucket, - 'Key' => $this->computePath($target), - 'SourceFile' => $path, - 'ACL' => $this->config('acl', 'public-read'), + 'Bucket' => $this->bucket, + 'Key' => $this->computePath($target), + 'SourceFile' => $path, + 'ContentType' => $finfo->file($path), + 'ACL' => $this->config('acl', 'public-read'), )); }