Currently I have a "Post" action in my web API controller. I first attempted having a byte[]
as the only argument, hoping it would "just work". Unfortunately, it did not and it complained about formatting and conversion for form-data
.
Now I have attempted to read the file content with this.Request.Content
, which others seem to have had success with. Unfortunately this is including more than I really want: The content disposition, the file name, the content type, and some kind of webkit form boundary. I assume it is all of the request content.
What is the right way to do this? I have found lots of answers for ASP .NET with the FileUpload control and many articles on how to upload to a .NET web API expecting a file via POST
.
Some articles mention Request.Files
but it is not part of the HttpRequestMessage
class.