I'm using multer to upload a file through node.js.
The file object that is sent from our FE is:
file: FileList
0: File
lastModified: 1647806297845
lastModifiedDate: Sun Mar 20 2022 21:58:17 GMT+0200
name: "Example Docx.docx"
size: 12143
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
webkitRelativePath: "
With the input's name attribute 'cv'.
My usage of multer is:
const uploadSingleFile = multer.single('cv');
uploadSingleFile(req, res, (err) => {
if (err) {
next(err);
}
next();
});
Yet I don't get any file in req.file
What am I missing?
The issue wad resolved by sending file[0] to multer.
It appears it's not designed to handle the FileList object in the scanario above.