entity.addPart(entry.getKey(), new StringBody(entry.getValue()));
}
if(null != imagePath) {
System.out.println("图片路径1==="+imagePath);
File file = new File(imagePath);
entity.addPart("authenfile", new FileBody(file));
}
httpRequest.setEntity(entity);
//取得HTTP response
HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest);
//若状态码为200 ok
System.out.println("状态吗====="+httpResponse.getStatusLine().getStatusCode());
if(httpResponse.getStatusLine().getStatusCode() == 200){
isNetError = false;
//注册返回值
regString = EntityUtils.toString(httpResponse.getEntity());
}else {
Log.e("serviceError", "the service is error!");
}
}catch(ClientProtocolException e) {
isNetError = true;
return regString;
}catch(UnsupportedEncodingException e) {
isNetError = true;
return regString;
}catch(IOException e) {
isNetError = true;
return regString;
}
return regString;
}