How does node express parse text data in form-data format before using multer?

  node.js, question

I want to verify the token before users upload photos, but after using multer middleware, it is found that the text type data cannot be obtained before the middleware, and can only be analyzed after multer processes the photos. how should I handle it? ? ?

I also found this problem. multer uploaded it directly. He had a separate incident, but it seemed useless.

This is what I wrote

coffeescriptbody = req.body
 path = res.locals.Path
 f = req.files.uploadpic
 if not f?  or f is ""
 Return res. sendnew helper.recode (201, "please specify the picture to upload")
 console.log oldname
 console.log body,path
 console.log req.files
 console.log f
 Location = __dirname plus "/../../public/uploadDir"
 Oldname = location plus "/"plus f.name
 
 if not body.album?  or body.album is ""
 fs.unlink oldname, (err)->
 Res.send new helper.recode(201, "album ID cannot be empty")
 return false
 if not body.token?  or body.token is ""
 fs.unlink oldname, (err)->
 Res.send new helper.recode(201, "you have not logged in yet, please log in first")
 return false
 if not res._user?  or res._user is ""
 fs.unlink oldname, (err)->
 Res.send new helper.recode(201, "you have not logged in yet, please log in first")
 return false

If the token is not correct, you will delete the pictures or files.

If the token check is OK, rename the uploaded file.