title: Upload file on amazon S3 with PHP SDK
body: <p>I'm trying to upload a picture on my amazon S3 via their PHP SDK. So I made a little script to do so. However, my script doesn't work and my exception doesn't send me back any error message.</p>
  
  <p>I'm new with AWS thank you for your help.</p>
  
  <p>Here is the code :</p>
  
  <p>Config.php</p>
  
  <pre><code>&lt;?php 
  
  return array(
  'includes' =&gt; array('_aws'),
  'services' =&gt; array(
    'default_settings' =&gt; array(
        'params' =&gt; array(
            'key'    =&gt; 'PUBLICKEY',
            'secret' =&gt; 'PRIVATEKEY',
            'region' =&gt; 'eu-west-1'
        )
      )
    )
  );
  
  ?&gt;
  </code></pre>
  
  <p>Index.php</p>
  
  <pre><code> &lt;?php
  
  
  //Installing AWS SDK via phar
  require 'aws.phar';
  
  use Aws\S3\S3Client;
  use Aws\S3\Exception\S3Exception;
  
  $bucket = 'infact';
  $keyname = 'myImage';
  
  // $filepath should be absolute path to a file on disk                      
  $filepath = 'image.jpg';
  
  // Instantiate the client.
  $s3 = S3Client::factory('config.php');
  
  // Upload a file.
  try {
  
  $result = $s3-&gt;putObject(array(
      'Bucket'       =&gt; $bucket,
      'Key'          =&gt; $keyname,
      'SourceFile'   =&gt; $filePath,
      'ContentType'  =&gt; 'text/plain',
      'ACL'          =&gt; 'public-read',
      'StorageClass' =&gt; 'REDUCED_REDUNDANCY'
  ));
  
   // Print the URL to the object.
      echo $result['ObjectURL'] . "\n";
  } catch (S3Exception $e) {
      echo $e-&gt;getMessage() . "\n";
  }
  
  ?&gt;
  </code></pre>
  
  <p>EDIT : I'm now using this code but its still not working. I don't even have error or exception message. </p>
  
  <pre><code>    &lt;?php
  
  require 'aws.phar';
  
  use Aws\S3\S3Client;
  use Aws\S3\Exception\S3Exception;
  
  $bucket = 'infactr';
  $keyname = 'sample';
  // $filepath should be absolute path to a file on disk                      
  $filepath = 'image.jpg';
  
  // Instantiate the client.
  $s3 = S3Client::factory(array(
      'key'    =&gt; 'key',
      'secret' =&gt; 'privatekey',
      'region' =&gt; 'eu-west-1'
  
      ));
  
  try {
      // Upload data.
      $result = $s3-&gt;putObject(array(
          'Bucket' =&gt; $bucket,
          'Key'    =&gt; $keyname,
          'SourceFile'   =&gt; $filePath,
          'ACL'    =&gt; 'public-read',
          'ContentType' =&gt; 'image/jpeg'
      ));
  
      // Print the URL to the object.
      echo $result['ObjectURL'] . "\n";
  } catch (S3Exception $e) {
      echo $e-&gt;getMessage() . "\n";
  }
  
  ?&gt;
  </code></pre>