Multer middleware not working
See original GitHub issueI have an issue trying to implement a binary upload route using multer
as a middleware.
Here’s my current code:
Meteor.startup(function() {
var multer = Meteor.npmRequire('multer');
var upload = multer({ storage: multer.memoryStorage() });
Picker
.filter(function(req, res) {
return req.method === 'POST';
})
.route('/upload', function(params, req, res, next) {
console.log(req.file);
res.end();
})
.middleware(upload.single('excel'));
});
And the output of that console.log(req.file)
is undefined
. I’ve also logged the whole req
object and cannot file any file
property in it.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9
Top Results From Across the Web
Unable to use Multer middleware - node.js - Stack Overflow
I am working on nodejs application i which i have to implement the upload files to AWS S3. I am trying to implement...
Read more >Express multer middleware
Multer is a node.js middleware for handling multipart/form-data , which is primarily used ... NOTE: Multer will not process any form which is...
Read more >Fix "Unexpected field" Error From Multer - Maxim Orlov
The foremost cause for this error is when the name attribute of the file input doesn't match the argument passed to one of...
Read more >Multer: Easily upload files with Node.js and Express
Multer is a Node.js middleware for handling multipart/form-data that makes the ... the server, Node.js in our case, has less work to do....
Read more >How to upload file using Multer in Express.js - Educative.io
Learn the 24 patterns to solve any coding interview question without getting lost in a maze of LeetCode-style practice problems. Practice your skills...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @Svenskunganka I actually solved this I think. This works.
I had the same problem and there is no solution on the internet, so I tried to figure it out and finally I realised that the problem is from
express-fileupload
module if I use the multer before the line where I set thefileUpload
middleware which isapp.use(fileUpload());
it works fine and the multer middleware will be invoked without any problem, so I ended up to remove fileUpload module and everything works fine