解决方法:不用MultipartFile.transferTo方法,别问我为啥
MultipartFile file
byte[] bytes = file.getBytes();
Path path = Paths.get(uploadPath);
if (!Files.isWritable(path)) {
Files.createDirectories(Paths.get(uploadPath));
}
Files.write(path, bytes); //文件写到服务器中
MD,弄了半天