I\'m trying to receive a lengthy base64 string from my Android Client and then decode it to a bitmap in my Web API Project to be uploaded as an image to an Azure BLOB Storage. H
Data can be either transmitted in the URL of a request, or in the body. You are currently transmitting the data in the URL. And the URL is only allowed to be a finite length. Instead, put your base64 string in the body. See Parameter Binding in ASP.NET Web API.
By default, simple parameters like strings are pulled from the URI. To force Web API to look for it in the body, we add a [FromBody]
attribute to the parameter.
[HttpPost]
[Route("api/addnewpost")]
public IHttpActionResult AddNewMediaActivity(string caption, string email,
string type, [FromBody] string base64String)
{
byte[] f = Convert.FromBase64String(base64String);
//more code........
}
And change your Android client code to put the base64 string in the body, not the URL. It's been a while since I've touched Java and I don't know what library you're using, but I imagine when you're building your HTTP request that you'll have the option of adding some data to the body of the request.