title: PHP Amazon SDK - s3 putObject and set Body
body: <p>hi i'm trying putting a new object into a bucket with this code:</p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
  
  require_once(FCPATH.'s3/aws-autoloader.php');
  
  use Aws\S3\S3Client;
  
  class s3{
      public $_secret_key ="********";
      public $_access_key = "********"; 
      public $_bucket = "tphotos-dev";
  
   function connect(){
  
       return  S3Client::factory(array(
      'key'    =&gt; $this-&gt;_access_key,
      'secret' =&gt; $this-&gt;_secret_key,
  ));
  
  
   }
   function deleteObject($prefix = false){
      if($prefix){
          $s3 = $this-&gt;connect();
          return $s3-&gt;deleteMatchingObjects($this-&gt;_bucket, $prefix);
      }
   }
  
   function putObject($file_name,$source_file){
      $s3 = $this-&gt;connect();
       $s3-&gt;putObject(array(
      'Bucket' =&gt; (string)$this-&gt;_bucket,
      'Key'    =&gt; $file_name,
      'SourceFile'   =&gt; $source_file,
      'ACL'         =&gt; 'public-read',
      ));
      return $s3-&gt;waitUntilObjectExists(array(
      'Bucket' =&gt; $this-&gt;_bucket,
      'Key'    =&gt; $file_name
      ));
  
   }  
  
  }
  </code></pre>
  
  <p>?></p>
  
  <p>so once i do for example:</p>
  
  <pre><code>$s3-&gt;putObject('myfilename.jpg',get_file_content("temp/image.jpg"));
  </code></pre>
  
  <p>it returns error:</p>
  
  <pre><code>Fatal error: Uncaught exception 'Aws\Common\Exception\InvalidArgumentException' with message 'You must specify a non-null value for the Body or SourceFile parameters.' in /Users/ok/Projects/s3/Aws/Common/Client/UploadBodyListener.php:91 
  </code></pre>
  
  <p>any clue ? </p>