title: Phonegap Amazon S3 SDK: The signature does not match
body: <p>I'm using Phonegap to capture and upload a video file to Amazon S3 and Amazon S3 SDK to get a pre-signed url for the request. Capturing and uploading works fine when using PHP server locally, also there is no issues with getting a pre-signed url from Amazon. However when I combine all this stuff: trying to upload the captured video to Amazon using generated pre-signed url I get "The request signature we calculated does not match the signature you provided."</p>
  
  <p>Here is my method to get pre-signed url and upload to Amazon:</p>
  
  <pre><code>uploadFile: function (file) {
      var //path = file.fullPath,
          path = file.localURL,
          name = file.name,
          type = file.type;
  
      var s3 = new AWS.S3(),
          s3_params = {
          Bucket: 'BUCKET_NAME',
          Key: name,
          Expires: 6000
          //ContentType: type,
          //ACL: 'public-read'
      };
  
      s3.getSignedUrl('putObject', s3_params, function(err, data){
          if(err){
              console.log(err);
          }
          else{
              var ft = new FileTransfer(),
                  url = encodeURI(data);
              console.log(data);
              ft.onprogress = function(progressEvent) {
                  if (progressEvent.lengthComputable) {
                      console.log(progressEvent.loaded / progressEvent.total);
                  } else {
                      console.log(progressEvent);
                  }
              };
  
              ft.upload(
                  path,
                  url,
                  function(result) {
                      console.log('Upload success: ' + result.responseCode);
                      console.log(result.bytesSent + ' bytes sent');
                  },
                  function(error) {
                      console.log('Error uploading file ' + path + ': ' + error.code);
                  },
                  {
                       httpMethod  : 'PUT',
                       fileName    :  name,
                       mimeType    :  type,
                       chunkedMode :  false,
                       headers: {
                           'Content-Type' :  type,
                           'x-amz-acl'    : 'public-read'
                       }
                  }
              );
          }
      });
  }
  </code></pre>
  
  <p>Am I doing something wrong?</p>
  
  <p>I know there are a lot of questions / answers on SO related to this subject, but nothing seems work for me...</p>
  
  <p>Please see the full test app here: 
  <a href="https://github.com/terreb/Phonegap-Media-Capture-S3-Upload" rel="nofollow">https://github.com/terreb/Phonegap-Media-Capture-S3-Upload</a></p>
  
  <p>Please advise!</p>