title: Save image with express sent by node script
body: <p>i'm trying to send an image with this nodejs script:</p>
  
  <pre><code>
  var http = require('http'),
      fs = require('fs');
  
  var post_options = {
      host: '192.168.43.193',
      path: '/testAPI/upload_img_mt',
      port: 80,
      timeout: 120000,
      method: 'POST',
      headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
      }
  }
  
  var sender = http.request(post_options, function(res) {
      if (res.statusCode &lt; 399) {
          var text = ""
          res.on('data', function(chunk) {
              text += chunk
          })
          res.on('end', function(data) {
              console.log(text)
          })
      } else {
          console.log("ERROR", res.statusCode)
      }
  })
  
  var POST_DATA = 'data={['
  POST_DATA += fs.readFileSync("C:/Users/alessio/Documents/FX/screenshot.png").toString()
  POST_DATA += ']}'
  console.log(POST_DATA)
  sender.write(POST_DATA)
  sender.end()
  </code></pre>
  
  <p>The code for server that will be save the image is this:</p>
  
  <pre><code>router.post('/upload_img_mt', function(req, res, next){
      console.log(req.body.data);
      fs.writeFile('downloaded.png', req.body.data, '', function (err){ console.log(err) });
      res.sendStatus(200);
  });
  </code></pre>
  
  <p>The problem is that the image is not a valid png and the size of image is not correct.</p>