Browse Source

logs

master
Rich Brown 1 year ago
parent
commit
4a4c0ffbc5
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      routes/createRouter.js

+ 4
- 1
routes/createRouter.js View File

@@ -11,7 +11,10 @@ const storage = multer.diskStorage({
filename(req, file, cb) {
const { originalname } = file;
const fiver = Math.random().toString(36).substr(2, 5);
const newFilename = `${originalname}-${fiver}${path.extname(originalname)}`;
const ext = path.extname(originalname);
console.log(ext);
const rootName = originalname.replace(ext, '');
const newFilename = `${rootName}-${fiver}${ext}`;
console.log(newFilename);
cb(null, newFilename);
},


Loading…
Cancel
Save