String uri = "https://graph.facebook.com/me/staging_resources";
HttpResponse response = null;
try {
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(uri);
MultipartEntity postEntity = new MultipartEntity();
String picPath = (Uri.parse(picUriStr)).getPath();
File file = new File("/data/local/tmp/images.jpg");
postEntity.addPart("file", new FileBody(file, "image/jpeg"));
postEntity.addPart("access_token", new StringBody("your access token string here"));
post.setEntity(postEntity);
response = client.execute(post);
}
catch (ClientProtocolException e) {
Log.d(TAG, "exception");
e.printStackTrace();
}
catch (IOException e) {
Log.d(TAG, "exception");
e.printStackTrace();
}
HttpEntity responseEntity = response.getEntity();
if (responseEntity== null) {
Log.d(TAG, "responseEntity is null");
return "";
}