These are chat archives for AlexanderKozhevin/ng-file-upload

14th
Apr 2016
Mumshad Mannambeth
@mmumshad
Apr 14 2016 23:49
anybody know how to upload multiple files at once with Node.JS?

I am trying to upload multiple files in Angular, backend NodeJS

Upload.upload({
            url: '/api/updateReport',
            fields: metadata,
            file: [imageFile, reportFile, additionalFile]
        })

On the server end, I try to get them like this:

var file = req.files.file;
imageFile = file[0]
reportFile= file[1]
additionalFile= file[2]

The problem is it is not always in the same order. Sometimes they mix up. ie imageFile is not the First file.

How do I get around this?

I tried to send data like below. But I can't seem to read the data on the server end. I am using 'connect-multiparty' middleware.

Upload.upload({
            url: '/api/updateReport',
            fields: metadata,
            data: {imageFile: imageFile, reportFile: reportFile, additionalFile: additionalFile}
        })