0

私のアプリケーションでは、オーディオと画像を含む複数の画像をサーバーに投稿したい.. MultipartEntityを使用していますが、postメソッドを呼び出すと取得していますHttpHostConnectionException: connection refused

これが私のコードです:

MultipartEntity entity=new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);

String path="mnt/sdcard/TAUKY/PICTURE/IMAGE_20130507_170848.png";
File f = new File(path);

String audio_path="mnt/sdcard/TAUKY/SOUND/SOUND_20130513_185502.wav";

File f_auido=new File(audio_path);          
entity.addPart("image", new FileBody(f));           
entity.addPart("audio", new FileBody(f_auido));         
entity.addPart("taukyname", new StringBody("My tauky"));            
entity.addPart("userId", new StringBody("63"));

hpost.setEntity(entity);

HttpResponse response = htpclnt.execute(hpost);
HttpEntity resEntity = response.getEntity();

Toast.makeText(getApplicationContext(), "Sucess"+response, 1000).show();
4

1 に答える 1

0

マニフェスト ファイルを確認します。インターネット許可を追加しましたか。実際のデバイスでテストします。

于 2013-05-16T06:41:42.097 に答える