V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
xhf1024
V2EX  ›  React

react+antd 实现上传图片怎么调用接口传图片

  •  
  •   xhf1024 · 2019-11-19 15:28:12 +08:00 · 2924 次点击
    这是一个创建于 1591 天前的主题,其中的信息可能已经有所发展或是发生改变。

    老哥们,大神们,怎么使用 react+antd 实现图片上传,后台接口的参数是 @RequestParam(value = "file") MultipartFile file 接口地址是 XXX/xxx/uploadImage 我前端不知道如何传参

    2 条回复    2020-04-14 00:24:18 +08:00
    xhf1024
        1
    xhf1024  
    OP
       2019-11-19 15:30:04 +08:00
    求救求救,头皮挠破
    vent123
        2
    vent123  
       2020-04-14 00:24:18 +08:00 via iPhone
    用 xmlhttprequest, post 调用后台接口,content-type 是 multipartfile,requestpayload 是{file: imagefile} 具体怎么做你搜一下吧
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1380 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 23:42 · PVG 07:42 · LAX 16:42 · JFK 19:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.