I am using the Busboy to upload the form data which contains the file and some text fields.
Every thing is working fine i am able to get the post parameters and file.
How can i achieve this: First I need to process the fields data and save in Db and process the file and update in same record in DB.
The busboy is first process the file and then process the fields.
req.pipe(req.busboy);
req.busboy.on('file', function (fieldname, file, filename) {
console.log("Uploading: " + filename);
console.log("fieldname: "+fieldname);
});
req.busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated) {
var jsondata = JSON.parse(val);
});
Any suggestions
Simple: just put your fields before your files in your form. Example:
<form>
<input type="text" name="foo">
<input type="text" name="bar">
<input type="file" name="baz">
</form>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With