Files
gg-backend/backend/src/controllers/upload.controller.js
T

16 lines
343 B
JavaScript
Raw Normal View History

2026-05-26 15:48:01 +05:30
import multer from 'multer';
import path from 'path';
2026-03-12 14:15:44 +05:30
const storage = multer.diskStorage({
destination: function (req, file, cb) {
2026-05-26 15:48:01 +05:30
cb(null, 'uploads/blog');
2026-03-12 14:15:44 +05:30
},
filename: function (req, file, cb) {
const fileName = Date.now() + path.extname(file.originalname);
cb(null, fileName);
},
});
2026-05-26 15:48:01 +05:30
export const upload = multer({ storage });