无法发布由设备相机拍摄的照片,并从图库中获取到 tumblr...请提出一些建议...我已经尝试使用多部分实体以及使用名称值对。我还附上了http请求文件格式数据、byte[]、base64格式数据和URLEncoder格式数据。
我尝试过的解决方案:
// #1
MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("type", new StringBody("photo"));
ByteArrayBody bab = new ByteArrayBody(byteArray, "image.jpg");
reqEntity.addPart("data", bab);
httpPost.setEntity(reqEntity);
// #2
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("type", "photo"));
nameValuePairs.add(new BasicNameValuePair("caption", "caption"));
nameValuePairs.add(new BasicNameValuePair("data", file);
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
//#3
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("type", "photo"));
nameValuePairs.add(new BasicNameValuePair("caption", "caption"));
nameValuePairs.add((NameValuePair) new ByteArrayUploadData(byteArray));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
请建议...