Answer the question
In order to leave comments, you need to log in
How to get the name of the file written by it in npm Multer?
When saving an image, the module adds its own unique code.
var multer = require('multer'),
storage = multer.diskStorage({
destination: function(req, file, callback) {
callback(null, __dirname + '/public/tmp/upload_avatars');
},
filename: function(req, file, callback) {
callback(null, file.originalname);
}
}),
upload = multer({ storage: storage });
app.post('/upload-image', upload.any(), function(req, res) {
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question