I have JavaScript code posting a XMLHttp Request to my Node.js application.
I managed to receive the request easily using express. However, I am not able to read the body of the POST request with bodyParser(). It just sais "undefined" or "{}" when accessing req.body.
How could I possibly do this?
The docs for connect's bodyParser
middleware in 1.x (or multipart
middleware in 2.x) say
As a security measure files are stored in a separate object, stored as
req.files
. This prevents attacks that may potentially alter filenames, and depending on the application gain access to restricted files.
Try
req.files.pic