make images dont overwrite each other :0
This commit is contained in:
parent
6b5c12510e
commit
e9b209edf1
2 changed files with 2 additions and 2 deletions
|
|
@ -1640,7 +1640,7 @@ const app = express();
|
||||||
const storage = multer.diskStorage({
|
const storage = multer.diskStorage({
|
||||||
destination: UPLOAD_DIR,
|
destination: UPLOAD_DIR,
|
||||||
filename: function (req, file, cb) {
|
filename: function (req, file, cb) {
|
||||||
cb(null, file.originalname);
|
cb(null, `${Util.uniqId()}-${file.originalname}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const upload = multer({ storage }).single('file');
|
const upload = multer({ storage }).single('file');
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ const app = express()
|
||||||
const storage = multer.diskStorage({
|
const storage = multer.diskStorage({
|
||||||
destination: UPLOAD_DIR,
|
destination: UPLOAD_DIR,
|
||||||
filename: function (req, file, cb) {
|
filename: function (req, file, cb) {
|
||||||
cb(null , file.originalname);
|
cb(null , `${Util.uniqId()}-${file.originalname}`);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const upload = multer({storage}).single('file');
|
const upload = multer({storage}).single('file');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue