Im trying to upload a file using express js. when it runs in local in work correctly. but when i try using fly io it doesnt run correctly. (req.file) shows false and runs with false condition.
const path =require(‘path’)
const multer =require(‘multer’)
var storage =multer.diskStorage({
destination:(req,file,cb)=>{
cb(null,__dirname+“SellerUploads/”)
},
filename: (req,file,cb)=>{
let ext = path.extname(file.originalname);
cb(null,Date.now()+ ext)
}
})
var upload =multer({
storage:storage,
fileFilter:(req,file,callback)=>{
if(file.mimetype == “image/png” || file.mimetype ==“image/jpg”){
callback(null,true);
}else{
console.log(“Image upload error”)
callback(null,false);
}
},
limits:{ fileSize: 102410242}
})
module.exports = upload;