I have an issue with multiple file upload in my sails app. I am trying to implement multiple file upload with Dropzone.js and my backend is Sails v0.10.0-rc8.
Now when I upload some files via dropzone, I see that in case of multiple upload it sends the files with separate params in the request. The param names are 'photo[0]', 'photo[1]', 'photo[2]',...
. I am getting the files in controller like this:
req.file(file).upload(function (err, files) {
// save the file
});
But when there is more then one file submitted, the request is being passed to controller before all files are parsed and stored from request, so I get only one file in my controller.
Has anyone experienced this issue? Maybe there is no support for multiple file upload with different request parameters in skipper body parser? Because when I submit several files inside one attribute ('photo'), all of them are handled and passed to controller.
req.file
is the parameter that the file was sent under, and in your case the files are all sent using different params, so it stands to reason that the.upload
would result in just one file being returned. I actually don't know if multiple calls toreq.file
will even work, but first lets be clear about whether you're trying that or not. – Pimple