title: Setting the Content Type Uploading Photos to S3 Bucket
body: <p>I am trying to upload photos to my S3 bucket.  The file being uploaded is making it to my S3 bucket successfully.  The problem?  Yup, it is in the form of 'application/octet-stream' though.  Given the implementation below, what changes do I need to make and where?</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;?php
  require 's3.php';
  
  $s3 = new S3('AWS_ACCESS_KEY_ID','AWS_SECRET KEY', 'region: us-west-2');
  
  if(isset($_FILES['file'])){
  
          $file = $_FILES['file'];
  
          $name = $file['name'];
          $tmp_name = $file['tmp_name'];
          var_dump($tmp_name);
  
          $extension = explode('.', $name);
          $extension = strtolower(end($extension));
          // var_dump($extension);
  
          $key = md5(uniqid());
          $tmp_file_name = "{$key}.{$extension}";
          $tmp_file_path = "files/{$tmp_file_name}";
  
          move_uploaded_file($tmp_name, $tmp_file_path);
  
          try{
              S3::putObject(
              $tmp_file_path,
              'mazzo-php-app',
              $tmp_file_name,
              S3::ACL_PUBLIC_READ,
              array(),
              array() 
              );
              unlink($tmp_file_path);
          } catch(S3Exception $e){
              die("There was an error uploading the file.");
          }
      }
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;title&gt;Upload&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form action="index.php" method="post" enctype="multipart/form-data"&gt;
              &lt;input type="file" name="file"&gt;
              &lt;input type="submit" value="Upload"&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>s3.php</p>
  
  <pre><code>// Content-Type
  if (!isset($input['type']))
          {
              if (isset($requestHeaders['Content-Type']))
                  $input['type'] =&amp; $requestHeaders['Content-Type'];
              elseif (isset($input['file']))
                  $input['type'] = self::__getMIMEType($input['file']);
              else
                  $input['type'] = 'application/octet-stream';
          }
  </code></pre>