Skip to content

Instantly share code, notes, and snippets.

@shadone
Created March 5, 2014 14:58
Show Gist options
  • Save shadone/9368834 to your computer and use it in GitHub Desktop.
Save shadone/9368834 to your computer and use it in GitHub Desktop.
app.post('/admin/item', isLoggedIn, function(req, res) {
var form = new multiparty.Form({
autofiles: true, // without this it will give a write stream(?)
uploadDir: __dirname + '/../public/uploads',
maxFilesSize: '10m'
});
form.parse(req, function(err, fields, files) {
if (err) {
console.log(JSON.stringify(err));
res.status(500).end();
return;
}
console.log(JSON.stringify({fields: fields, files: files}));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment