[Solved] Android Photo Upload


So after lots of tweaking and research i found out that the way i passed the image was wrong. On the code I had yesterday, I converted the image bitmap to base64 string and then convert that string to bytes array. This was wrong as I have to convert the bitmap image to bytes array directly:

        java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.JPEG,100,baos);

        byte[] b = baos.toByteArray();
        imageBytes  = b;

and pass it to my output stream outputStream.writeBytes(imageData); part and change it to outputStream.write(imageBytes);.
I hope this helps beginners like me who can’t get help from the ‘experts’ of SO.

solved Android Photo Upload