Multer: Content-type = 'multipart/form-data', req.body, req.file still undefined

Created on 13 Oct 2017  ·  6Comments  ·  Source: expressjs/multer

I waste a lot of time to resolve this problem, I have tried to use html form element post data, and use FormData object post data. But it stile undefined in my req.body

shotcut for my http request:
http

my server code:
server

and server log:
log

Besides, .single(fieldname), Are this 'fieldname' is the formdata file key?

Most helpful comment

I ve got the point,my problem made by I have a redirect server which didnt handle the request. so when a post a request , it lose the data on the middle redirect server. Now I pipe the request or temp save and resend formdata to final server,it worked!

All 6 comments

Hmm, the only thing I can think of is that something else is consuming the body before multer. Do you have any other middlewares that runs before this route?

@LinusU I have the same issue and I have removed all middlewares to test it and still fails.

Interesting, would you mind posting similar data as @jyjin did? I think it could help me debug the issue 😃

I ve got the point,my problem made by I have a redirect server which didnt handle the request. so when a post a request , it lose the data on the middle redirect server. Now I pipe the request or temp save and resend formdata to final server,it worked!

Glad to hear that you solved it!

@juanmav if you still have a problem and can share some more data I'll reopen this 👌

xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Paul-Morris picture Paul-Morris  ·  3Comments

tonghae picture tonghae  ·  4Comments

karandutt01 picture karandutt01  ·  3Comments

adrienbarreau picture adrienbarreau  ·  3Comments

bpetty-formfast picture bpetty-formfast  ·  3Comments