I am trying to bind data in my model posted from postman in my below model:
public class VariantModel
{
public int Id { get; set; }
public List<SubvariantModel> Subvariants { get; set; }
}
public class SubvariantModel
{
public int Id { get; set; }
public string Description { get; set; }
public IFormFile Document { get; set; }
}
Every property is getting populated but only Document
property is coming null as you can see here :
But surprisingly when i inspect http request object i see that file :
This is how i am posting data from POSTMAN :
Code :
[HttpPost]
public void Post([FromForm]VariantModel emp)
{
var d = HttpContext.Request;
}
Can anybody tell me what could be the issue here?
Update :
This is an issue I encountered as well. It is a known issue with nesting IFormFile as a View Model property in .NET Core v2.2.
The fix that worked for me is here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.