代码如下
public static void uploadImage(String url) {
//url += "/platform/sys/upload/file";
Request req = Request.create(url, METHOD.POST);
File file;
FileWriter fw;
try {
file = new File("d:\\test\\5909ce0626744ecaad60b02a1cc92e29.png");
fw = new FileWriter(file);
fw.flush();
fw.close();
req.getParams().put("file", file);
FilePostSender sender = new FilePostSender(req);
Response resp = sender.send();
if(resp.isOK()){
System.out.println(resp);
}
} catch (IOException e) {
e.printStackTrace();
}
}