-6

How to send this format of data to a server?

enter image description here

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Guna Sekhar
  • 355
  • 1
  • 3
  • 14

1 Answers1

1

Just encode it to Base64.

Try this,

    private static String encodeFileToBase64Binary(File file) {
    String encodedfile = null;
    try {
        FileInputStream fileInputStreamReader = new FileInputStream(file);
        byte[] bytes = new byte[(int) file.length()];
        fileInputStreamReader.read(bytes);
        encodedfile = Base64.encodeToString(bytes, 1);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return encodedfile;
}
msecilmis
  • 348
  • 2
  • 11