Friday, September 21, 2012

SENDING FILE TO WEB SERVER USING ANDROID


FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(image);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
     
           bitmap=BitmapFactory.decodeStream(fileInputStream);
           ByteArrayOutputStream baos = new ByteArrayOutputStream();
           bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
           byte[] data = baos.toByteArray();
           IMAGE= Base64.encodeBytes(data);
           Log.e("THE IMAGE BYTES",""+IMAGE);




IMAGE IS STRING TO SEND TO WEB SERVER 

No comments:

Post a Comment