I am trying to pull an base64 encoded image from my app to database(which is in my server), but I get this error.
the server responded with a status of 414 (Request-URI Too Long)
I know that for URLs, shortening them fixes the error but I can't shorten a base64 string.
How to fix this one.
HttpGet httpGet = new HttpGet(URL);
try {
HttpResponse response = httpClient.execute(httpGet);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusCode == 200) {
HttpEntity entity = response.getEntity();
InputStream inputStream = entity.getContent();
BufferedReader reader = new BufferedReader(
new InputStreamReader(inputStream));
String line;
while ((line = reader.readLine()) != null) {
stringBuilder.append(line);
}
inputStream.close();
} else {
Log.d("JSON", "Failed to download file");
}
}
Try Retrofit. Use @FormUrlEncoded in retrofit and @POST("ur_api_name") and send the data using @Field("data") annotation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With