Using multer in express to upload files, how can the uploaded files be resolved without Filename extension?

  node.js, question

Use multer in express to upload files. The uploaded files have no Filename extension

var uploadZoneFile = upload.fields([{
 name: 'uploadLittleimg',
 maxCount: 1
 }, {
 name: 'uploadImg',
 maxCount: 1
 }, {
 name: 'uploadVoice',
 maxCount: 1
 }]);
 
 router.post('/addZone', uploadZoneFile, function(req, res, next){
 
 
 console.log(req.files)
 
 var _uploadLittleimg = req.files.uploadLittleimg;
 var _uploadImg = req.files.uploadImg;
 var _uploadVoice = req.files.uploadVoice;
 
 If (_ uploadlittlemg) req.body.littlemg = "/uploads/"plus _ uploadlittlemg [0]. filename;
 If (_ uploadimg) req.body.img = "/uploads/"plus _uploadImg[0].filename;
 If (_ uploadvoice) req.body.voice = "/uploads/"plus _uploadVoice[0].filename;
 next();
 
 bracket
 ...

clipboard.png

clipboard.png

There are filename and mimetype, how to add Filename extension?
I went to the official website to see that there are no parameters to do this operation.
Look at the source code I also very laborious, I am still a novice, ask the great god for advice thank you

Then you can’t use it anymoreupload.fieldsWell, you have to use itdiskStorage, code similar to:

var storage = multer.diskStorage({
 destination: function (req, file, cb) {
 cb(null, '/uploads');
 },
 filename: function (req, file, cb) {
 Cb(null, file.fieldname plus'. configure Filename extension here yourself');
 bracket
 })
 
 var upload = multer({ storage: storage })
 
 router.post('/addZone', upload, function(req, res, next){
 
 
 console.log(req.files)
 
 var _uploadLittleimg = req.files.uploadLittleimg;
 var _uploadImg = req.files.uploadImg;
 var _uploadVoice = req.files.uploadVoice;
 
 If (_ uploadlittlemg) req.body.littlemg = "/uploads/"plus _ uploadlittlemg [0]. filename;
 If (_ uploadimg) req.body.img = "/uploads/"plus _uploadImg[0].filename;
 If (_ uploadvoice) req.body.voice = "/uploads/"plus _uploadVoice[0].filename;
 next();
 
 bracket