I was facing this problem too. Short answer: remove the Content-Type
header from your Postman request.
The long story is that the Content-Type
for a multipart request should be rather special -- it should look kind of like this:
multipart/form-data; boundary=----WebKitFormBoundaryzeZR8KqAYJyI2jPL
The problem is that the boundary is important and it needs to exactly match the boundary used to separate the files being uploaded. The solution is simple: do not specify a Content-Type
! When you upload files, Postman will automatically append the above content type for you, except the boundary will be filled in with whatever Postman or Chrome is using to separate the multipart content.
You can verify this behavior by using Chrome developer tools (within Postman) to examine the Content-Type
header being added, in addition to the Content-Disposition
headers of the multipart data, which are also a pain to construct manually (and impossible within Postman).
Note: My answer is a solution for those who need a multipart/form-data
answer. The OP was looking for a multipart/mixed
solution. My answer will not suffice in this scenario. That being said, it seems a lot of people just want the multipart/form-data
solution, so I will leave my answer here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…