From dc7b5ac4a98dee8a44d314d6f71765d00435224f Mon Sep 17 00:00:00 2001 From: peecky Date: Fri, 28 Mar 2014 21:22:12 +0900 Subject: [PATCH 1/3] store form data to the req.body --- lib/uploadhandler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/uploadhandler.js b/lib/uploadhandler.js index 8403595..1b1fb17 100644 --- a/lib/uploadhandler.js +++ b/lib/uploadhandler.js @@ -91,6 +91,7 @@ module.exports = function (options) { self.emit('begin', fileInfo); }) .on('field', function (name, value) { + self.req.body[name] = value; if (name === 'redirect') { redirect = value; } From d09b8882d759e7db1efbc66d0277d77a5c55ed42 Mon Sep 17 00:00:00 2001 From: Michael Kuenzli Date: Tue, 22 Apr 2014 11:06:37 +0200 Subject: [PATCH 2/3] adding form fields to fileInfo --- lib/uploadhandler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/uploadhandler.js b/lib/uploadhandler.js index 1b1fb17..d887c7f 100644 --- a/lib/uploadhandler.js +++ b/lib/uploadhandler.js @@ -68,6 +68,7 @@ module.exports = function (options) { if (!--counter) { async.each(files, _.bind(function(fileInfo, cb) { this.initUrls(fileInfo, _.bind(function(err) { + fileInfo.formData = self.req.body; this.emit('end', fileInfo); cb(err); }, this)); From 8d9ab1f77107bf6c9ba080507311508d7b3ae743 Mon Sep 17 00:00:00 2001 From: Michael Kuenzli Date: Tue, 22 Apr 2014 11:29:03 +0200 Subject: [PATCH 3/3] add body if not exists --- lib/uploadhandler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/uploadhandler.js b/lib/uploadhandler.js index d887c7f..fc4c4d7 100644 --- a/lib/uploadhandler.js +++ b/lib/uploadhandler.js @@ -92,6 +92,7 @@ module.exports = function (options) { self.emit('begin', fileInfo); }) .on('field', function (name, value) { + if(!self.req.body) self.req.body = {}; self.req.body[name] = value; if (name === 'redirect') { redirect = value;