shell 脚本post方式上传文件

久未见 提交于 2020-03-05 07:17:20

 要批量上传一些数据,已经写好了文件上传的接口,现在需要把数据通过http的post 请求发送到服务上面

 注意 file 和 接收端的 file 名字一样

curl -H "Expect:" -F 'file=@test_2020-03-03.txt' http://192.168.100.xx:xxxx/api

接收端:

  @PostMapping("/api")
    public @ResponseBody Map<String,Object> method(@RequestParam("file") MultipartFile file, HttpServletRequest request) throws UnsupportedEncodingException {
        //存放返回结果
        Map<String,Object> result = new HashMap<String,Object>();
        return result;
}

 搞定!!!

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!