httpPost中上传图片 httpclient实现
大家好:
我想在Android软件中实现上传图片的功能。Post上传,用httpclient实现
相关代码如下:
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
List<BasicNameValuePair> result = new ArrayList<BasicNameValuePair>();
//添加参数
BasicNameValuePair pair = new BasicNameValuePair("status", “文本信息”);
result.add(pair);
httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
HttpResponse httpResponse = httpClient.execute(httpPost);
图片文件形式为:
File file = new File("/sdcard/picture.jpg");
请问各位高手,如何将图片file转换并且添加到参数中?
谢谢