score:0

assuming you have already installed multer, if you see the following code

router.post("/", upload.single("myfile"), (req, res, next) => {
  console.log(req.file);

the "myfile" has to be the name of the formfield coressponding to the file that is being passed, which in your case is "imagedata". try replacing "myfile" with "imagedata".

also set headers for the axios post request being made from react. the form attributes may not have effect on the manual http requests

var header = {
        'content-type': 'multipart/form-data'
    }

await axios.post("/", fd,{ headers : header });

try and let me know if it works.


Related Query

More Query from same tag