C
C#2y ago
JUK_Karol

❔ Sending IFormFile in Postman

endpoint parameter is OfferCreateDto and I can't send it in Postman, when I sending one image as form-data in other endpoint it works, can someone tell me what's wrong here?
7 Replies
Angius
Angius2y ago
I don't think you can send images with JSON You need x-form-urlencoded payload, or whatever it's called Ah, wait, you are sending formdata, huh Does the API endpoint get the data from form, though? [FromForm] on the parameter?
JUK_Karol
JUK_KarolOP2y ago
nah dto is only parameter, im trying to avoid split it to 2 parameters (IFormFile list and dto)
Angius
Angius2y ago
Well, there's you answer ASP thinks offerDto should be parsed from JSON But it's a form
JUK_Karol
JUK_KarolOP2y ago
so split it is only way?
Angius
Angius2y ago
You can't send some of the request as JSON and some of it as form data Send everything as form data
JUK_Karol
JUK_KarolOP2y ago
so I didn't have to modify endpoint input in code?
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?