title: Amazon S3 get version id of object on upload
body: <p>I enabled versioning in my bucket to prevent overwriting files with the same name. When I create an object in my php app I need to store the version id in my database to use when deleting the object. </p>
  
  <p>I'm currently getting the version id from the returned header response from uploading</p>
  
  <pre><code>//upload the file           
  $response = $s3-&gt;create_object($bucket, $filename, array(
      'fileUpload' =&gt; $filepath,
      'acl' =&gt; AmazonS3::ACL_PUBLIC,
      'contentType' =&gt; $this-&gt;upload-&gt;file_type,
      'storage'     =&gt; AmazonS3::STORAGE_REDUCED,         
  ));
  
  //get version id 
  $version_id' =&gt; $response-&gt;header['x-amz-version-id'];
  </code></pre>
  
  <p>Is this the correct way to do it? I need to use version ids when deleting objects and need to save the version ids of corresponding objects in the db when uploading. I would really appreciate your advice. </p>