File size: 1,129 Bytes
97f53b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// const multer = require('multer');

// //Disk storage where image store
// const storage = multer.diskStorage({
//     destination: function (req, file, cb) {
//         cb(null, './uploads/fruits');
//     },
//     filename: function (req, file, cb) {
//         cb(null, file.originalname);
//     }
// });

// function storage(path) {
//     return diskStorage({
//         destination: function (req, file, cb) {
//             cb(null, path);
//         },
//         filename: function (req, file, cb) {
//             cb(null, file.originalname);
//         }
//     });
// }

// //Check the image formate
// const fileFilter = (req, file, cb) => {
//     // reject a file
//     if (file.mimetype === 'image/jpeg' || file.mimetype === 'image/png' || file.mimetype === 'image/jpg') {
//         cb(null, true);
//     } else {
//         cb(null, false);
//     }
// };

// function filePath(path) {
//     return multer({
//         storage: storage(path),
//         limits: {
//             fileSize: 1024 * 1024 * 5
//         },
//         fileFilter: fileFilter
//     });

// }

// module.exports = { filePath }