Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1x 1x 1x 1x 1x 1x 1x | const multer = require("multer"); const path = require("path"); require("dotenv").config(); const DIR_UPLOAD = path.join(process.cwd(), process.env.DIR_UPLOAD); const storage = multer.diskStorage({ destination: function (_req, _file, cb) { cb(null, DIR_UPLOAD); }, filename: function (_req, file, cb) { cb(null, file.originalname); }, }); const upload = multer({ storage: storage, limits: { fileSize: 2000000 }, fileFilter: (_req, file, cb) => { if (file.mimetype.includes("image")) { cb(null, true); return; } cb(null, false); }, }); module.exports = upload; |