Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -39,13 +39,13 @@ const storage = multer.diskStorage({
|
|
| 39 |
const upload = multer({
|
| 40 |
storage: storage,
|
| 41 |
fileFilter: function (req, file, cb) {
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
limits: {
|
| 50 |
fileSize: 10 * 1024 * 1024 // 10MB limit
|
| 51 |
}
|
|
|
|
| 39 |
const upload = multer({
|
| 40 |
storage: storage,
|
| 41 |
fileFilter: function (req, file, cb) {
|
| 42 |
+
// Accept image and video files
|
| 43 |
+
if (file.mimetype.startsWith('image/') || file.mimetype.startsWith('video/')) {
|
| 44 |
+
cb(null, true);
|
| 45 |
+
} else {
|
| 46 |
+
cb(new Error('Only image and video files are allowed!'), false);
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
limits: {
|
| 50 |
fileSize: 10 * 1024 * 1024 // 10MB limit
|
| 51 |
}
|