I'm using formidable (github) and I'm not sure about the scope of some variables inside the callbacks.
Part of my code is:
UploadHandler.prototype.upload = function(req, res){
var query = url.parse(req.url, true).query;
var form = new formidable.IncomingForm();
var id = query['X-Progress-ID'];
self.uploads.add(id);
form.parse(req, function(err, fields, files){
self.uploads.remove(id);
res.writeHead(200, { 'Content-type': 'text/plain' });
return res.end('upload received');
});
...
}
My question is, what will be the value of id inside the callback of parse? Also, will that code work as expected if more than 1 person is uploading a file? (As in, will id change it's value for both the first and the second person if they're both using the uploader at the same time.