• Akhilesh Kumar 17
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
hi this is apex method by which corropted image is uploaded 
public pagereference my()
{
string Endpoint = 'https://www.googleapis.com/upload/drive/v2/files?uploadType=media ';
HttpRequest req= new HttpRequest();

req.setHeader('Authorization','Bearer '+access_token);    
req.setHeader('Content-Type','image/jpeg');     
req.setHeader('uploadType','media');
req.setHeader('data','content');  
req.setHeader('Content-Length','199808');


  // req.setHeader('Content-Encoding','base64');



system.debug('kkkkkkkk'+access_token);
  req.setEndpoint(Endpoint );
String pictureString =  EncodingUtil.base64Encode(puredocument.body);

pictureString = EncodingUtil.urlEncode(pictureString, 'UTF-8');

String tiStmp=String.valueOf(System.NOW().getTime() / 1000);

String myData = 'public_id=codeauthtoken&timestamp='+key + secret ;

Blob hash = Crypto.generateDigest('SHA1',Blob.valueOf(myData));

String hexDigest = EncodingUtil.convertToHex(hash);

String fileString = 'data:image/jpeg;base64,';   

String finalBodyString ='public_id=accesstoken&api_key='+access_token+
'&timestamp='+ EncodingUtil.urlEncode(tiStmp, 'UTF8')+
'&signature='+EncodingUtil.urlEncode(hexDigest, 'UTF-8')+
'&file='+EncodingUtil.urlEncode(fileString, 'UTF-8') + pictureString.trim();  

req.setBody(finalBodyString); 
req.setMethod('POST');          
 Http h2=new Http();
HttpResponse res = h2.send(req); 
system.debug(res);
return null;


}
Hi...
I want to integrate Google Hangout with Salesforce for video calling and telephonic through visualforce page 
I want to help regads this problems. 
Hi...
I want to integrate Google Hangout with Salesforce for video calling and telephonic through visualforce page 
I want to help regads this problems. 
Hi...
I want to integrate Google Hangout with Salesforce for video calling and telephonic through visualforce page 
I want to help regads this problems.