title: Save PHP file_get_contents stream to AWS S3
body: <p>Im trying to get a remote file (an image) using PHP and then put that image to an S3 Bucket.</p>
  
  <p>It mostly works, except that the file that is uploaded to S3 is empty when downloaded back again. </p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>$src = "http://images.neventum.com/2016/83/thumb100x100/56f3fb1b9dbd6-acluvaq_63324840.png";
  $name = md5(uniqid());
  $ext = pathinfo($src, PATHINFO_EXTENSION);
  
  $file_content = file_get_contents($src);
  $filename = "{$name}.{$ext}";
    try {
       $file = $this-&gt;s3-&gt;putObject([
         'Bucket' =&gt; getEnv('s3bucket'),
         'Key' =&gt; $filename,
         'Body' =&gt; $file_content,
         'ACL' =&gt; 'private'
       ]);
    } catch (S3Exception $e) {
      //Catch 
    }
  </code></pre>
  
  <p>Hope you can help. Thank you so much in advance. </p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>The problem is not with the ACL (I have tested using "public"), is that the saved object on S3 is not uploded correctly (I think is something to do with the encoding, but have not been able to figure it out)</p>