1

The file is being send to the nodejs server, but the upload.single gives an unexpected end of form error. How do i fix this?

const upload = multer({ dest: "../../uploaded_images" });    
router.patch("/profile", upload.single("profileImage"), (req, res) => {   
    console.log(req.files) // This shows that there is a file named profileImage, I can see that when I remove the upload.single("profileImage")
    res.send("")
})

the file structure:

enter image description here

warre
  • 33
  • 1
  • 8

1 Answers1

0

It seems to be a bug in Multer itself. I solved by downgrading Multer to 1.4.3.

See https://github.com/expressjs/multer/issues/1144

Lucio Crusca
  • 1,277
  • 3
  • 15
  • 41
  • The bug is seemingly still not fixed and the problem with 1.4.3 is to my understanding that there is an existing security defect. – Spurious Mar 08 '23 at 14:38