diff --git a/src/controller/warehouse.controller.js b/src/controller/warehouse.controller.js index 01c7a4a..555490b 100644 --- a/src/controller/warehouse.controller.js +++ b/src/controller/warehouse.controller.js @@ -59,7 +59,6 @@ module.exports = { * Upload an image for the warehouse */ addWarehouseImage: async (req, res, next) => { - // req.file contains the `warehouse-image` console.dir("Warehouse image uploaded:", { file: req.file }); const { id } = req.params; diff --git a/src/middleware/fileUpload.js b/src/middleware/fileUpload.js index ad27f9f..e26d9ca 100644 --- a/src/middleware/fileUpload.js +++ b/src/middleware/fileUpload.js @@ -6,26 +6,17 @@ const storage = multer.diskStorage({ cb(null, "./uploads/"); }, limits: { - // files: 1, + // files: 1, // Limit number of file uploads, if needed fileSize: 1024 * 1024, }, filename: function (req, file, cb) { cb( null, - file.fieldname + - "-" + - Date.now() + - "." + - file.originalname.split(".")[file.originalname.split(".").length - 1] + file.fieldname + "-" + Date.now() + "." + file.originalname.split(".")[file.originalname.split(".").length - 1] ); }, onFileUploadStart: function (file) { - console.log("Inside uploads"); - if ( - file.mimetype == "image/jpg" || - file.mimetype == "image/jpeg" || - file.mimetype == "image/png" - ) { + if (file.mimetype == "image/jpg" || file.mimetype == "image/jpeg" || file.mimetype == "image/png") { return true; } else { return false;