java代码:
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("/testEntity")
public class TestController {
/**
* 上传文件
*/
@PostMapping("/upload")
public void upload(@RequestPart("file") MultipartFile file) {
// TODO 文件处理逻辑
}
}
Postmam调用