Postman文件上传报错:The current request is not a multipart request解决方法

时间:2024-03-22 08:05:25

文章转载自:https://blog.csdn.net/u012049760/article/details/71159800

“error”: “Internal Server Error”,
“exception”: “org.springframework.web.multipart.MultipartException”,
“message”: “Current request is not a multipart request”, “path”: “/upload”

错误原因:Headers填写错误,估计是之前选错了x-www-form-urlencoded
Postman文件上传报错:The current request is not a multipart request解决方法
由于上传文件用的Content-Type应该是multipart/form-data,修改之后依然报错。

“error”: “Internal Server Error”,
“exception”: “org.springframework.web.multipart.MultipartException”,
“message”: “Could not parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found”,
“path”: “/upload”

解析之后发现Content-Type实际用的是text/plain。但是这么输入依然报相同错误。

多次试验之后发现,Content-Type无论选择什么,都会报错。正确的做法是删除Content-Type就行了**