I have method that upload files to nodeJS. But now, I want to send the files and another data:
formData.append('files[]', files[i], filename); --> OK
Now, I add this:
formData.append('ORIGIN', origin_array);
I send data like this:
this.http.post(url, formData, options).pipe(map(result => result))
In nodeJS, I am using "multer" library for get files, and it is OK, but I don't know how to get origin item.
In node, I have this code:
module.exports = {
uploadMultimedia: multer({
storage: storage,
limits: {
fieldNameSize: 1 * 1024 * 1024,
fileSize: 1000 * 1024 * 1024 // 5000MB
}
}).single('file'),
uploadMultimediaArray: multer({
storage: storage,
limits: {
fieldNameSize: 1 * 1024 * 1024,
fileSize: 1000 * 1024 * 1024 // 5000MB
}
}).array('files[]', 10)
}
And this is my API who calls multer:
exports.multimedia = function (req, res) {
//CODE
}
Sorry about my english.