Last active
August 4, 2020 16:11
-
-
Save imamabdulazis/33a656ce3b7839168d72f6f3aa119563 to your computer and use it in GitHub Desktop.
SDF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const storage = multer.diskStorage({ | |
| destination: function (req, file, cb) { | |
| cb(null, './uploads/'); | |
| }, | |
| filename: function (req, file, cb) { | |
| console.log("FILE :", file) | |
| cb(null, file.originalname); | |
| } | |
| }) | |
| const fileFilter = (req, file, cb) => { | |
| if (file.mimetype === 'image/jpeg' || file.mimetype === 'image/png') { | |
| cb(null, true); | |
| } else { | |
| cb(null, false); | |
| } | |
| } | |
| const upload = multer({ | |
| storage: storage, | |
| // limits: { | |
| // fileSize: 1024 * 1024 * 5 | |
| // }, | |
| // fileFilter: fileFilter | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment