无法发布设备相机拍摄的照片以及从图库中拾取到Tumblr的照片...请以某种方式建议... 我尝试使用multipart实体以及使用namevaluepair。 另外我附上了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));
请建议......