title: Using s3 server-side encryption with PHP
body: <p>I have decide to avail of amazons new server-side encryption with s3, however, I have run into a problem which I am unable to resolve.</p>
  
  <p>I am using the s3 PHP class found here : <a href="https://github.com/tpyo/amazon-s3-php-class" rel="nofollow">https://github.com/tpyo/amazon-s3-php-class</a></p>
  
  <p>I had been using this code to put objects originally (and it was working) :</p>
  
  <pre><code>     S3::putObjectFile($file, $s3_bucket_name, $file_path, S3::ACL_PRIVATE,
           array(),
      array( 
          "Content-Disposition" =&gt; "attachment; filename=$filename",
          "Content-Type" =&gt; "application/octet-stream"
              )
  );
  </code></pre>
  
  <p>I then did as instructed here : <a href="http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTObjectPUT.html" rel="nofollow">http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTObjectPUT.html</a> and added the '<strong>x-amz-server-side​-encryption</strong>' request header. But now when I try to put an object it fails without error.</p>
  
  <p>My new code is :</p>
  
  <pre><code>  S3::putObjectFile($file, $s3_bucket_name, $file_path, S3::ACL_PRIVATE,
       array(),
  array( 
      "Content-Disposition" =&gt; "attachment; filename=$filename",
      "Content-Type" =&gt; "application/octet-stream",
          "x-amz-server-side​-encryption" =&gt; "AES256"
          )
  </code></pre>
  
  <p>);</p>
  
  <p>Has anybody experimented with this new feature or can anyone see an error in the code.</p>
  
  <p>Cheers.</p>