我正在尝试将媒体上传到Android中的Twitter。我正在使用这个Update with Media Api。我使用以下代码
multiPartEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
try
{
multiPartEntity.addPart("status", new StringBody("Metallica rules man! |m|"));
multiPartEntity.addPart("media[]", new InputStreamBody(getResources().openRawResource(R.drawable.metallica), "metallica.jpg"));
post = new HttpPost("https://api.twitter.com/1.1/statuses/update_with_media.json");
post.setEntity(multiPartEntity);
post.addHeader("Content-Type", "multipart/form-data");
post.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
consumer.sign(post);
response = client.execute(post);
entity = response.getEntity();
} catch (Exception e1)
{
e1.printStackTrace();
}
但我从Twitter获得了error code 131 - Internal error。我也尝试以字节数组的形式发送图像但是徒劳无功。我得到了同样的错误。有谁可以帮我解决这个问题?