title: php file_put_content to aws S3
body: <p>i am trying to write a file to aws s3 which obviously is not working now.</p>
  <p>in my code i now have the following where the signedurl is the complete s3 url</p>
  <pre><code>$url = ($signedurl);
  
  $opts = array(
    'http'=&gt;array(
      'method'=&gt;&quot;PUT&quot;,
      'header'=&gt; array (&quot;Connection: keep-alive&quot;,&quot;Content-Lenght: &quot;.$filesize,&quot;Content-Type: audio/mpeg&quot;,&quot;Accept: */*&quot;)
    )
  );
  $filelocation = &quot;/home/martin/Dropbox/data/track&quot;.date(&quot;dmY&quot;).'_MP3WRAP.mp3';
  
  $contexta = stream_context_create($opts);
  $afile = file_get_contents($url, false, $contexta);
  $file = file_put_contents($filelocation, $afile);
  </code></pre>
  <p>What happens now is that the file is not being uploaded with the required headers and i dont see where this goes wrong.</p>
  <p>Any help is appriciated</p>