title: Uploading a base64 image from IOS to S3 using Node.js
body: <p>I have the following code to upload an image from ios device to AWS S3 using node.js:</p>
  
  <pre><code>  var buf = new Buffer(req.body.image.replace(/^data:image\/\w+;base64,/, ""),'base64')
  
    var s3bucket = new AWS.S3({params: {Bucket: 'forplay-static', Key: 'test.png'}});
    s3bucket.putObject(buf, function(err, data) {
      if (err) {
        return res.send({ success: false, err: err });
      } else {
        return res.send({ success: true });
      }
    });
  </code></pre>
  
  <p>The image I am posting is: <a href="http://pastebin.com/kcmXJbRd" rel="nofollow">http://pastebin.com/kcmXJbRd</a></p>
  
  <p>This returns the following error in err:</p>
  
  <pre><code>{ "code": "UnexpectedParameter", "name": "UnexpectedParameter" }
  </code></pre>
  
  <p>What is the correct way of uploading a base64 image to S3?</p>