• Android_Dev
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    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.

 

Right now i am using REST API to upload custom object information and able to upload all data, but one of our table contains image field (with data type: Rich Text Area(32768) ) - so how to upload image from Android client to this custom object... 

 

As per current finding i did not find any file/image upload support in REST API (multi-part post for file uploading)

 

Any help/pointer on this will be greatly appriciated

 

Thank You.

Is it possible to embed an image in a Force.com custom object? For example, if I want to create a custom object for real estate properties and I want to embed images of the properties in the custom object.

If so, how can it be done?

 

thx,

Arno

  • March 07, 2012
  • Like
  • 0