在我的应用程序中,我想将多个图像发布到服务器,包括音频和图像.. 我正在使用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();