Couldn't find a native way to handle these, seems multipart enctypes
are stripped. So, if anyone is wondering how to do this, here's a
chunk of code that should help you along your way:
var formidable = require('formidable');
app.post('/moments', function(req, res, next){
var form = new formidable.IncomingForm();
form.parse(req, function(err, fields, files) {
console.log('received upload:\n\n');
console.log(sys.inspect({fields: fields, files: files}));
this.moment = new this.app.models.Moment;
['title', 'duration'].forEach(function (field) {
if (typeof fields[field] !== 'undefined') {
this.moment[field] = fields[field];
}
}.bind(this));
this.moment.save(function (errors) {
if (errors) {
console.log(errors)
return;
} else {
return;
}
}.bind(this));
}.bind(this));
});