From 6455b71284f491ddf667913ceb833fc216260098 Mon Sep 17 00:00:00 2001 From: s_jqzhang Date: Thu, 31 Jan 2019 14:33:53 +0800 Subject: [PATCH] add java upload doc --- doc/upload.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 doc/upload.md diff --git a/doc/upload.md b/doc/upload.md new file mode 100644 index 0000000..d8f2b82 --- /dev/null +++ b/doc/upload.md @@ -0,0 +1,30 @@ +## java版本 +依赖(这里使用了hutool工具包,更简便) +```xml + + cn.hutool + hutool-all + 4.4.3 + +``` +上传代码 +```java +public static void main(String[] args) { + //文件地址 + File file = new File("D:\\git\\2.jpg"); + //声明参数集合 + HashMap paramMap = new HashMap<>(); + //文件 + paramMap.put("file", file); + //输出 + paramMap.put("output","json"); + //自定义路径 + paramMap.put("path","image"); + //场景 + paramMap.put("scene","image"); + //上传 + String result= HttpUtil.post("http://xxxxx:xxxx/upload", paramMap); + //输出json结果 + System.out.println(result); +} +``` \ No newline at end of file