I have the following client service:
var request = require('request');
var fs = require('fs');
var file = "c:\\log.txt";
var url = "http://localhost:8080/upload";
fs.createReadStream(file).pipe(request.post(url));
Here is the code on the server:
var express = require('express');
var app = express();
app.use(express.bodyParser());
var fs = require('fs');
var sys = require('sys');
app.listen(8080);
app.post('/upload', function (req, res) {
console.log(req.files);
});
I want to eventually save the files received on the server. Right now when I run the service, then the client, the server logs an empty array - {} instead of the files uploaded.
How do I solve this?
Update: The server code works because I successfully tested it using Fiddler.