M
M
Max Yaremenko2016-11-03 13:35:09
Node.js
Max Yaremenko, 2016-11-03 13:35:09

POST request, postman multipart/form-data, sending an image, what's wrong?

Good afternoon.
+ I make a request via postman: form-data, specify the key (file) in the body and file type - file, select a picture 100kb, click send
how to get the properties of the picture?
console.log(req.files.file);
TypeError: Cannot read property 'file' of undefined
+ If I just write console.log(req.body) I get the image itself but I can't get its properties.
res.json({par: req.body});
{
"par": {
"------WebKitFormBoundarywGyH56j1QQEYFSe6\r\nContent-Disposition: form-data; name": "\"file\"; filename=\"pic.jpg\"\r\nContent-Type :imag................
What am I doing wrong?(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2016-11-03
@SagePtr

Middleware for parsing request body with multipart/form-data type enabled?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question