Save image upload to directory

0

I am uploading an image using multer, I would like to know how to save this image to a specific directory, already with its original extension: .jpeg.

    
asked by anonymous 20.06.2016 / 20:14

1 answer

0
var storage = multer.diskStorage({  
  destination: function (req, file, cb) {  
    cb(null, './data/multer')  
  },   
  filename: function (req, file, cb) {   
      cb(null, file.originalname);           
  }   
})   
var upload = multer({ storage: storage })  
    
22.06.2016 / 15:52