1 | public class HttpUtils { |
使用方法:1
2
3
4
5
6
7
8
9
10
11
12
13private void uploadFileByHttpUtils(String url,File file,String fileName){
Map<String, Object> paramsMap = new HashMap<String, Object>();
paramsMap.put("file", file);
paramsMap.put("fileName", fileName);
try {
String josn = HttpUtils.post(url, paramsMap);
Log.i(TAG, josn);
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}