Browse files

misc

  • Loading branch information...
1 parent 98571c0 commit 01bd648b82c31705c668e8ce8d34786c2d97f890 @tj tj committed Nov 17, 2011
Showing with 19 additions and 1 deletion.
  1. +19 −1 lib/middleware/bodyParser.js
View
20 lib/middleware/bodyParser.js
@@ -117,5 +117,23 @@ exports.parse['application/json'] = function(req, fn){
*/
exports.parse['multipart/form-data'] = function(req, fn){
- var form = new formidable.IncomingForm;
+ var form = new formidable.IncomingForm
+ , body = {};
+
+ form.on('field', function(name, val){
+ body[name] = val;
+ });
+
+ form.on('file', function(){
+ console.log(arguments);
+ });
+
+ form.on('error', fn);
+
+ form.on('end', function(){
+ req.body = body;
+ fn();
+ });
+
+ form.parse(req);
};

0 comments on commit 01bd648

Please sign in to comment.