michealmorgan/kohana-storage — Issue #1: S3 contentType for uploaded files
Author: Slaver
Created: 2011-10-18 13:36:02+00:00
State: open

All uploaded files to S3 has content_type `binary/octet-stream`. It's not good for static files such as images, documents.

Solution for file `classes/kohana/storage/s3.php` in protected `function _set`:

```PHP
$acl = $this->_config['public'] ? AmazonS3::ACL_PUBLIC : AmazonS3::ACL_PRIVATE;

// Get MIME-type of files
$extension = explode('.', $path);
$extension = array_pop($extension);
$mime_type = CFMimeTypes::get_mimetype($extension);

$this->_driver->create_object($this->_config['bucket'], $path, array(
'fileUpload' => $handle,
'acl' => $acl,
'contentType' => $mime_type,
));
```