File transfer to FTP server using node.js callout

I suggest that you use nodejs modules to handle the parsing of the multipart form, and the FTP. I can make some suggestions.

Some sample code might be:

http.createServer(function(req, res) {
  if (req.url === '/upload' && req.method.toLowerCase() === 'post') {
    // parse a file upload
    var form = new formidable.IncomingForm();
    form.uploadDir = uploadDir;

    form.parse(req, function(err, fields, files) {
      res.writeHead(200, {'content-type': 'text/plain'});
      res.write('received upload:\n\n');
      res.end(util.inspect({fields: fields, files: files}));

      // upload to FTP Server here...
      // follow the node-ftp-client example I referred above.

    });

    return;
  }

}).listen(port);

Here’s a start; a working example of an API Proxy that uses a hosted target , and the formidable module.

https://github.com/DinoChiesa/apiproxy-nodejs-formidable