Node.js TypeError: Cannot read property 'file' of undefined
You are using upload.single
, which you should use req.file
not req.files
. To upload multiple files, use upload.array
.
Notice that you don't need another .file
after req.file
. req.file
is the uploaded file if you are using upload.single
.