Reputation: 708
My ajax call:
$http({
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' },
url: myURL,
data: { "data": content },
dataType: 'json'
})
My api controller is
[Route("upload")]
[AcceptVerbs("POST")]
public string upload([FromBody]byte[] data) {
return "";
}
Upvotes: 0
Views: 330
Reputation: 708
I sent the data as the string and converted to Base64 on the controller. It worked for me.
It seems there is one more way to do it that is writing a custom MediaTypeFormatter.
Upvotes: 2