Created
March 26, 2014 03:59
-
-
Save GregoryHlavac/9776761 to your computer and use it in GitHub Desktop.
This file contains 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
app.post('/submit', function(req, res) { | |
var cdOpts = { | |
maxFilesSize: app.nconf.get("submit_file_byte_limit"), // This is 2 MB | |
autoFields: true, | |
autoFiles: true, | |
uploadDir: "./minidumps" | |
}; | |
var form = new multiparty.Form(cdOpts); | |
form.on('error', function(err) { | |
console.log(err); | |
res.header('Connection', 'close'); | |
res.send(413, "Error"); | |
}); | |
form.on('file', function(name, file) { | |
console.log("File Received as Field: " + name); | |
console.log(file); | |
}); | |
form.on('close', function() { | |
res.send(200, "Success"); | |
}); | |
form.parse(req); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment