我使用提取从前端发送文件:
const invokeSavePayments = file => fetch("/rest/importPayments", {
method: "POST",
credentials: "same-origin",
body: file,
});
如何在spring-rest-controller中接收它(或更好地获取InputStream)?
@RequestMapping(value = {"/importPayments"}, method = RequestMethod.POST)
public Map<String, List<Payment>> importPayments() throws IOException {
//need to get inputStream here
p.s。
我尝试使用
public Map<String, List<Payment>> importPayments(@RequestParam("file") Object uploadedFileRef)
但是有错误信息 500内部服务器错误
当前请求不是多部分请求
Stacktrace:org.springframework.web.multipart.MultipartException: 当前请求不是多部分请求