Multer gives unexpetcted end of form error
Asked Answered
P

1

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

Petr answered 3/6, 2022 at 7:10 Comment(2)
did you get solution?Saccharometer
This is the solution I used and it worked for me; Solution to "unexpetcted end of form" errorDamage
P
1

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

Pesade answered 16/1, 2023 at 14:21 Comment(1)
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.Capsaicin

© 2022 - 2024 — McMap. All rights reserved.