Sending Image to server in android - android

In android I am trying to send image to the server.I am using Multipart request. But when I add image in format ByteArray to the Multipart UnsupportedEncodingException occurs.
following is my code.
Do I need to add mime type to request.
If possible please post the complete Sample code.

Try converting the Image to Base64 format string and then sending that string to the server.
Here's the link to convert image to base64 format.
And then at server end decode it.

I done it with the use of MultiPartEntity . Added image as byteArrayBody and done the HTTP request.

Related

Decode a string encoded with Brotli returned by Android Volley

I'm sending an http request to a website using Volley (POST and StringRequest). The call is correctly executed. However, I can see that the result is a string codified. When seeing the headers of the answer I can see it is encoded in br, which means brotli. How can I decode the answer to later read it as a JSON?
Should I change to OkHttp or another alternative?

WCF Multipart Custom Class

I send a POST request from an Android App using the ION library. The request has some multipart parameters and an attachment file.
Something like this:
.setMultipartParameter("Message", message)
.setMultipartParameter("TextFileName", textFileName)
.setMultipartParameter("TextFileContentBase64Encoded", TextFileContentBase64Encoded)
.setMultipartFile("AttachementFile", fileName)
The problem is that server side(WCF), we have a custom class used for parsing this request that has a Stream for the attachment file, and 3 Strings for other parameters. From my understanding, WCF limits you. You can't parse a custom class that has a Stream and other parameters. You either have a Stream or you have other params.
The question is how can you parse a incoming request that has a stream and other parameters in WCF?
Thanks!

How to convert FileBytes into a File?

I am receiving following JSON response from the server for showing the file in my android project.
"FileBytes":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQSEhUUExQWFhQXFxcYGBgXFxUZFhgXHBUXFhYXGBgYHCggGBolHBYUIjEhJSkrLi4uFx8zODMsNygtLisBCgoKDg0OGhAQGywkHSQsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLP/AABEIALcBEwMBIgACEQEDEQH/xAAcAAAABwEBAAAAAAAAAAAAAAAAAQIDBAUGBwj/xABOEAABAwIDBAcEBgUJBgYDAAABAgMRACEEEjEFBkFREyJhcYGRoQcyUrEUI0LB0fAzYnLC4RUWQ1OCkqKy0iRjc7PT8Rc0hJOjwyVUg//EABoB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UmQdQYIPeNKYjlG1tljZy0rC8ri0q6yDBAEaREa3jWqrHbzYoEkYl7LaIcVbTtrrTm6uDWZVhmZP8Au0j/ACxUR/cXAL1YSO5Tifkqs3js0jOuxyZG92M4Yp3uKifnWj2LvFii0VuPrIJ6ugMg3BIGhrVK9mmB/qz/AO46P3qnYbdPDtoDYbTkBJAJUrXW5Mms5Ypdi1lXdGVc2m6oyHXIIB988QKKts3sZtIgIQAP1R+FCs/08/Jfrx8FkWJ404Gu38+dChXTpRz6mH9HH5ig3hwAB+H4UdCnpQtTF9CKR9GSLga60KFPSgtg6McqCmRyHkKFCnSFY0tpQ90gdhEj8RSBiCCEqsTpxB7j+NChSewyQFUtJNChVCHEmlRQoUCCy0Mo5UKFABECjIihQpDG1OxrajzHUGhQoAbLh5z2RFR3CDZST5gihQpABLKeFvOlBs/F5gfdFChTAc6LmJHf90URZSNUx+eyhQpgL6IcKbWyTyoUKBDSmDRAEaGhQpUMfbJi/wB1Fbs8qOhTAEiiUBQoUAGAPzP40KFCmB//2Q==",
As i am newbie , I am not understanding how to convert this into a file.
It can be a any type of file like xyz.jpeg,.png,.pdf...anything
Please help me.
It is not possible to do this type of conversion, hence server itself change the service to send the file not filebytes with some authentication.

Upload Image From Android to ASp.net Server

I am trying to upload image fromandroid to asp.net server.
I am following following procedure.
convert image from bitmap to byte[] yhen byte[] to string and pass this string to the asp.net web service
is this correct way to save image on to the .net server
Please Give the solution to upload image from android to asp.net server
both client and server side code .
The simplest way is convert your bitmap to base64 string :
public String encodeTobase64(Bitmap image)
{
Bitmap immagex=image;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
immagex.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] b = baos.toByteArray();
String imageEncoded = Base64.encodeToString(b, Base64.DEFAULT);
return imageEncoded;
}
after converting ,you can send the string to webservice, on the server side, you must decode this string to an image !
To convert base64 to image on server side,duckduckgo or google will help you :
https://duckduckgo.com
https://www.google.com/search?sclient=psy-ab&site=&source=hp&btnG=Search&q=convert+base64+to+image+ASp.net+Server
Have a look at this tutorial by Microsoft - you'll be able to use the Build the Web Service part for the web service.
For the Android part, you can get inspired by all other questions that try to send a POST request - for example this one.
If not too late, here is my suggested solution:
Server side: you can create a web service or RESTful application on the .NET Framework. Microsoft provides ASP.NET Web API. You can start from their website here
Client side: your Android here. You can refer to some of the following: Volley, Retrofit...
If you want to use Volley, you can refer to some following links:
Working POST Multipart Request with Volley and without HttpEntity
How to send a “multipart/form-data” POST in Android with Volley
Trouble Sending Multipart File with Boundary via Volley
Of course, you can find more available in SO.
Hope this helps!

Android failing to send large json string through Http Post

I am trying to send an image as a base64 to a php based web service. The image that I am sending is around 500 kb . I am first compressing the image and then converting the image into base64 string. But the image is not being sent. If i try it through Fiddler, I am successful in sending the image. Is there anyway to increase the http post request call of android? I am using the following libraries: DefaultHttpClient and HttpPost.
In my case , adding UTF-8 solved my problem
StringEntity se;
se = new StringEntity(json.toString(),"UTF-8");
httppostreq.setEntity(se);
response = client.execute(httppostreq);

Categories

Resources