Sample code to upload a file to chatter feed using REST API

Step 1: Download required files Download the following files from internet httpcomponents-client-4.2.3-bin.zip org.apache.commons.httpclient.jar From the files, I have added following JARS to my project in eclipse. Screenshot from Ecclipse Step 2: Get Access Token Through Chrome Login to your Salesforce instance and navigate to Setup -> Create -> Apps. Create a custom app and fill Client ID and CallBack URL (ex: http://www.google.com) in the following URL. Encode the CallBack URL before passing it as a parameter. https:// <instance_name> .salesforce.com/services/oauth2/authorize?response_type=token&client_id= <Client_ID_Goes_Here> &redirect_uri= <CallBack_URL> Paste this URL in chrome In Developer Tool -> Network select "preserve log upon navigation" Load the page. We see below page. The page will take us to RemoteAccessAuthorizationPage.apexp which inturn will lea...