• praful
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I am integrated REST API (v20.0) in my Android application, as per current requirement i would like to upload image from Android application to custom object (in custom field, where datatype is Rich Text Area)...

 

As per current implementation i am getting error message: Invalid encoding specified:  base64. The base64 is the only supported encoding.","errorCode":"INVALID_DATA_URI"

 

Android Code:

// Here 'imgBytes' object is nothing but compressed image data
String encodedImage = Base64.encodeToString(imgBytes, Base64.DEFAULT);

// Put base64 image data with image tag in JSON object parameter
data.put("Meter_Reading_Picture__c", "<img src=\"data:image/jpeg; base64," + encodedImage + "></img>");

// ....
post.setHeader("Authorization", "OAuth " + myTokens.get_access_token());
post.setHeader("Content-type", "application/json");

// ...
// execuating Http request

 

Any help/pointer on this would be gretly appriciated - thank you.