mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 01:43:43 +00:00
folder restructure
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import multer from 'multer';
|
||||
|
||||
const storage = multer.diskStorage({
|
||||
destination: function (req, file, cb) {
|
||||
cb(null, 'uploads/');
|
||||
},
|
||||
filename: function (req, file, cb) {
|
||||
cb(null, Date.now() + '--' + file.originalname);
|
||||
},
|
||||
});
|
||||
|
||||
// filter only json
|
||||
const filterJson = (req, file, cb) => {
|
||||
if (file.mimetype.includes('application/json')) {
|
||||
cb(null, true);
|
||||
} else {
|
||||
cb(null, false);
|
||||
}
|
||||
};
|
||||
|
||||
const uploadJson = multer({ storage: storage, fileFilter: filterJson });
|
||||
|
||||
export default uploadJson.single('jsondb');
|
||||
Reference in New Issue
Block a user