Skip to content Skip to sidebar Skip to footer

Upload Base64 Encoding Image To WCF Service From Android

I have an Android program that can upload an image to a WCF service. The WCF service accepts a JSON object with image name, folder name and a base64 encoding of the image. I use fi

Solution 1:

Hi guys finally i figured out problem. Problem is encoding so I use class Base64.java that I downloaded from internet. I use following method for encording

public static String encodeTobase64(Bitmap image) throws IOException
{
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();  
    image.compress(Bitmap.CompressFormat.JPEG, 50, outputStream);
    byte[] bs = outputStream.toByteArray();
    String imageEncoded=Base64.encodeBytes(bs);
    return imageEncoded;
}

and use returned value as file stream. So my problem is solved.


Post a Comment for "Upload Base64 Encoding Image To WCF Service From Android"