C
C#12mo 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
Angius12mo 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_Karol12mo ago
nah dto is only parameter, im trying to avoid split it to 2 parameters (IFormFile list and dto)
Angius
Angius12mo ago
Well, there's you answer ASP thinks offerDto should be parsed from JSON But it's a form
JUK_Karol
JUK_Karol12mo ago
so split it is only way?
Angius
Angius12mo 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_Karol12mo ago
so I didn't have to modify endpoint input in code?
Accord
Accord12mo 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.