CommonsMultipartResolver

spring文件上传处理器


    CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(getServletContext());
    boolean multipart = multipartResolver.isMultipart(req);
    logger.debug("multipart:" + multipart);
    MultipartFile[] files = null;
    if (multipart) {
        MultipartHttpServletRequest request = multipartResolver.resolveMultipart(req);
        Map fileMap = request.getFileMap();
        files = (MultipartFile[]) fileMap.values().toArray(new MultipartFile[0]);
        req = request;
    }

你可能感兴趣的:(spring,上传文件)