httpclient上传图片与参数,处理中文乱码
2013-10-30 17:32
477 查看
public static void main(String[] args) throws Exception {
String url="http://192.168.100.234:6888/aic/aicexi/commoncase/writ/WritUploadAction.jsp";
HttpClient client = new HttpClient();
PostMethod pos = new PostMethod(url);
File file=new File("C:/Users/Administrator/Desktop/psb.jpg");
Part[] part=new Part[]{new FilePart(file.getName(), file),new StringPart("JS@fsDescriptionInformation", "测试","GBK"),
new StringPart("JS@fdSentTime", "2013-10-24")};
pos.setRequestEntity(new MultipartRequestEntity(part,pos.getParams()));
client.executeMethod(pos);
System.out.println(pos.getResponseBodyAsStream());
}
String url="http://192.168.100.234:6888/aic/aicexi/commoncase/writ/WritUploadAction.jsp";
HttpClient client = new HttpClient();
PostMethod pos = new PostMethod(url);
File file=new File("C:/Users/Administrator/Desktop/psb.jpg");
Part[] part=new Part[]{new FilePart(file.getName(), file),new StringPart("JS@fsDescriptionInformation", "测试","GBK"),
new StringPart("JS@fdSentTime", "2013-10-24")};
pos.setRequestEntity(new MultipartRequestEntity(part,pos.getParams()));
client.executeMethod(pos);
System.out.println(pos.getResponseBodyAsStream());
}
相关文章推荐
- httpclient post 上传文件及参数包括中文乱码问题方案
- HttpClient使用Post和Get提交参数 中文乱码处理
- httpclient上传文件,同时带字符串参数 中文乱码问题
- android使用AsyncHttpClient上传图片以及参数到服务器
- httpclient中getmethod方法的url参数如果含有中文的处理办法
- HTTPCLIENT MultipartEntity 上传中文乱码
- HttpClient 处理中文乱码
- HttpClient 处理中文乱码
- HTTPClient PostMethod 中文乱码处理
- 关于httpclient上传文件是中文名称的处理
- 关于HttpClient上传中文乱码的解决办法
- HttpClient 处理中文乱码
- 关于HttpClient上传中文乱码的解决办法
- HttpClient4.5.2版本中POST提交中文参数时乱码问题解决方法
- Android 关于HttpClient上传中文乱码的解决办法
- 关于HttpClient上传中文乱码的解决办法
- HttpClient Post和Get请求实例+ 中文参数处理
- jsp编码及url请求中文乱码、图片上传文件名乱码
- BS开发技巧之四: 处理取中文参数出现乱码问题
- HttpURLConnection中文参数乱码url转码java