Created
April 29, 2014 10:55
-
-
Save artcommacode/11396809 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Restify.prototype.handleFiles = function (req, res, next) { | |
| var form = new multiparty.Form(); | |
| form.parse(req, function (error, fields, files) { | |
| fields = qs.parse(fields); | |
| for (var object in fields) { | |
| req.body[object] = {}; | |
| for (var param in fields[object]) { | |
| req.body[object][param] = Array.isArray(fields[object][param]) ? fields[object][param][0] : fields[object][param]; | |
| } | |
| } | |
| req.files = files && files.files ? files.files : null; | |
| next(); | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment