私が欲しいもの自分のSDカードからサーバーにビデオを送信したいと思います。私はまた、いくつかのパラメータ/値を送る必要があります。私はこのコードを実行すると、私はHTTP Post Multipartエンティティを使用してビデオを送信する
HttpResponse response = httpClient.execute(httpPost, localContext);
は、私が手にこのラインで動けなくなる問題は何
public String SendToServer(String aUrl,File aFile)
{
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(aUrl);
try
{
MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
entity.addPart("file", new FileBody(aFile));
entity.addPart("video[title]", new StringBody("testVideo"));
entity.addPart("video[type]", new StringBody("1"));
httpPost.setEntity(entity);
HttpContext localContext = new BasicHttpContext();
// Bind custom cookie store to the local context
localContext.setAttribute(ClientContext.COOKIE_STORE, Globals.sessionCookie);
HttpResponse response = httpClient.execute(httpPost, localContext);
HttpEntity resEntity = response.getEntity();
String Response = "";
if (response != null)
{
Response = EntityUtils.toString(resEntity);
}
return Response;
}
catch (IOException e)
{
e.printStackTrace();
}
return "Exception";
}
:私は、次のコードを試してみましたを試してみました
例外も無応答もまったくありません。誰も私を導いてください、ここで何が問題なのですか?
インターネットのアクセス許可を設定しているのですか、複数のパーティのjarファイルに依存関係があるのを見て、それらをインポートするかどうかは.....ですか? –
@Khawarサーバーログを確認しましたか? –
@Vipinはいアクセス許可を設定しました。この依存関係についてもう少し説明してください。それが問題かもしれません。私はそれを知らない。 – Khawar