猿问

Antd 的 upload 后台该如何接收?

@RestController
@RequestMapping("/antdUpload")
public class AntdUpload {

    private Logger logger = LoggerFactory.getLogger(AntdUpload.class);

    @RequestMapping(method = RequestMethod.PUT)
    public void postExcel(@RequestParam("file")MultipartHttpServletRequest request, HttpServletResponse response) throws IOException {

        logger.info("antd-upload");

        //1. build an iterator
        Iterator<String> itr = request.getFileNames();
        MultipartFile mpf = null;

        //2. get each file
        while (itr.hasNext()) {

            //2.1 get next MultipartFile
            mpf = request.getFile(itr.next());

            InputStream is = mpf.getInputStream();

        }
    }
}

结果后台根本收不到请求,不知道是什么问题?

阿波罗的战车
浏览 2202回答 4
4回答

海绵宝宝撒

@RequestMapping(method = RequestMethod.PUT) uploder发起的是post
随时随地看视频慕课网APP

相关分类

Java
我要回答