0

I can't find a way to send binary file jpg with json Rest. The last one that I tried is with Base64.encodeToString(byte[] array, Base64.DEFAULT) and I expected in the server side with Base64.getDecoder().decode(String)... yet no results. I have seen many posts, but nothing has helped. Can you suggest me any way or library.

I am using java with Eclipse. In the client side I use android.util.Base64 library, while in server side I use java.util.Base64.

The error that show me is this:

Unexpected padding character ('=') as character #4 of 4-char base64 unit: padding only legal as 3rd or 4th character; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type byte[] from String

Federico Navarrete
  • 3,069
  • 5
  • 41
  • 76
boris
  • 1
  • 4
  • 1
    Could you give us more details on your server and application. Like the language you're using, libraries... –  Apr 27 '18 at 12:50
  • I am using java with eclipse. In the client side I use android.util.Base64 library, while in server side I use java.util.Base64. The error that show me is this: Unexpected padding character ('=') as character #4 of 4-char base64 unit: padding only legal as 3rd or 4th character; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `byte[]` from String – boris Apr 27 '18 at 12:52
  • Why are you using Eclipse? The Eclipse ADT plugin is no longer supported, as per this announcement in June 2015. https://developer.android.com/studio/tools/sdk/eclipse-adt You must use Android Studio. – Federico Navarrete Apr 27 '18 at 13:02
  • I know, but what to do... I have just come in the company and that's the way that they are working – boris Apr 27 '18 at 13:03
  • You can Refer this one : https://stackoverflow.com/questions/20322528/uploading-images-to-server-android – Rohan Kadu Apr 27 '18 at 13:10

0 Answers0