dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.64k stars 25.28k forks source link

Model Binding Not Working #7979

Closed erguergu closed 6 years ago

erguergu commented 6 years ago

My controller action's IFormFile parameter is always null. I tried decorating it with [FromForm] and that didn't help. I made sure I threw the enctype="multipart/form-data" into my form, and I'm using a kendo FileUpload control with Angular6, and it seems kendo sets the following header: Content-Type: multipart/form-data; I'm not sure if that is a direct analog to setting the enctype attribute on the form. If it is, I can confirm that I'm sending that header. The only guess I have is that it also sets a boundary with what looks like some webkit constant that might be inconsistent? Is there any way to troubleshoot this? I am having to fall back to using Request.Form.Files, which is a severe first-world problem.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

erguergu commented 6 years ago

Oops, I just realized it's because I was using a single value, rather than an array of IFormFile!!