Answer the question
In order to leave comments, you need to log in
How to check if a directory exists, and if not, create it using multer?
Used to upload files multer
.
const storage = multer.diskStorage({
destination: 'uploads',
filename: function (req, file, cb) {
cb(null, file.fieldname + '-' + Date.now())
}
})
'uploads'
have to create with pens, because it multer
saysYou are responsible for creating the directory when providing destination as a function. When passing a string, multer will make sure that the directory is created for you.
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