Multer and the req
Posted on October 21, 2018
Learning is about discovering tips and tricks that ease your daily job.
Today I've learned something about the popular uploading module for Node.js, Multer, that ease the management of file upload functionality.
After a lot of trial and error trying to move the uploaded file to a specific location based on some user sent parameters, without luck, I've found the solution on this StackOverflow post.
This is the hint:
Note that req.body might not have been fully populated yet. It depends on the order that the client transmits fields and files to the server.
So, the order of the field sent by the user form is relevant to the backend behaviour.