const multer = require('multer');

const storage = multer.diskStorage({
    destination: (req, file, cb) => {
        cb(null, 'uploads/capacitaciones')
    },
    filename: (req, file, cb) => {
        const ext = file.originalname.split('.').pop();
        const random = Math.floor(Math.random() * 1000000);
        cb(null, `capacitacion-${Date.now()}-${random}.${ext}`)
    }
});

module.exports = multer({ storage });