springboot二进制流binary方式接收文件上传
// 路由注解可添加consumes参数指定Content-Type类型,如application/octet-stream
@PostMapping(value = "/test")
public void testBinary(HttpServletRequest request) throws IOException {
File targetFile = new File("d:/test333.png");
ServletInputStream inputStream = request.getInputStream();
// org.apache.commons.io.FileUtils
FileUtils.copyInputStreamToFile(inputStream, targetFile);
}
@PostMapping(value = "/test")
public String testText(@Req
共有 0 条评论