title: React Native upload to S3 with presigned URL
body: <p>Been trying with no luck to upload an image to S3 from React Native using pre-signed url.  Here is my code:</p>
  
  <p>generate pre-signed url in node:</p>
  
  <pre><code>const s3 = new aws.S3();
  
  const s3Params = {
    Bucket: bucket,
    Key: fileName,
    Expires: 60,
    ContentType: 'image/jpeg',  
    ACL: 'public-read'
  };
  
  return s3.getSignedUrl('putObject', s3Params);
  </code></pre>
  
  <p>here is RN request to S3:</p>
  
  <pre><code>var file = {
    uri: game.pictureToSubmitUri,
    type: 'image/jpeg',
    name: 'image.jpg',
  };
  
  const xhr = new XMLHttpRequest();
  var body = new FormData();
  body.append('file', file);
  xhr.open('PUT', signedRequest);
  xhr.onreadystatechange = () =&gt; {
    if(xhr.readyState === 4){
      if(xhr.status === 200){
        alert('Posted!');
      }
      else{
        alert('Could not upload file.');
     }
   }
  };
  xhr.send(body);
  </code></pre>
  
  <p>game.pictureToSubmitUri = <code>assets-library://asset/asset.JPG?id=A282A2C5-31C8-489F-9652-7D3BD5A1FAA4&amp;ext=JPG</code></p>
  
  <p>signedRequest = <code>https://my-bucket.s3-us-west-1.amazonaws.com/8bd2d4b9-3206-4bff-944d-e06f872d8be3?AWSAccessKeyId=AKIAIOLHQY4GAXN26FOQ&amp;Content-Type=image%2Fjpeg&amp;Expires=1465671117&amp;Signature=bkQIp5lgzuYrt2vyl7rqpCXPcps%3D&amp;x-amz-acl=public-read</code></p>
  
  <p>Error message:</p>
  
  <pre><code>&lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt;
  &lt;Message&gt;
  The request signature we calculated does not match the signature you provided. Check your key and signing method.
  &lt;/Message&gt;
  </code></pre>
  
  <p>I can successfully curl and image to S3 using the generated url, and I seem to be able to successfully post to requestb.in from RN (however I can only see the raw data on requestb.in so not 100% sure the image is properly there).</p>
  
  <p>Based on all this, I've narrowed my issue down to 1) my image is not correctly uploading period, or 2) somehow the way S3 wants my request is different then how it is coming in.</p>
  
  <p>Any help would be muuuuuucchhhh appreciated!</p>
  
  <p>UPDATE</p>
  
  <p>Can successfully post from RN to S3 if body is just text ({'data': 'foo'}).  Perhaps AWS does not like mutliform data?  How can I send as just a file in RN???</p>