ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,194 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How to accept file in binary format in asp.net core web api controller and processed it. I have request see image below
and i try to accept it in my controller but it doesn't work
[HttpPost("catalist")]
public async Task<IActionResult> UploadFromCatalistAsync([FromBody] byte[] binaryFile, CancellationToken token)
{
//process binaryFile
return Ok();
}
but I get error 415 Unsupported Media Type, could please help me what changes I need to make in my API to accept the file in this type?
Don’t use a method parameter, instead use the body stream from the request.