How should the upload backend of Antd receive it?

@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();

        }
    }
}

as a result, there is no request at all in the backend. I don"t know what the problem is.


you should decide what to upload at the front end according to the parameter requirements of the backend. If the format of antd is not satisfied, you can directly write an upload and use the native input [type=file] .


can you truncate the request image under the browser network? Now that we haven't used antd, we don't know how to answer you (I don't know how to upload it at the front end)


even though I'm a rookie. But come to think of it, this has nothing to do with antd .


@RequestMapping(method = RequestMethod.PUT)

uploder initiated post

Menu