小编Moh*_*ved的帖子

请求被拒绝,因为在springboot中找不到多部分边界

正如我正在尝试使用带有postman chrome附加组件的spring boot和webservices.

在邮递员content-type="multipart/form-data"和我得到以下例外.

HTTP Status 500 - Request processing failed; 
nested exception is org.springframework.web.multipart.MultipartException: 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
Run Code Online (Sandbox Code Playgroud)

在Controller中我指定了以下代码

@ResponseBody
@RequestMapping(value = "/file", headers = "Content-Type= multipart/form-data", method = RequestMethod.POST)

public String upload(@RequestParam("name") String name,
        @RequestParam(value = "file", required = true) MultipartFile file)
//@RequestParam ()CommonsMultipartFile[] fileUpload
{
    // @RequestMapping(value="/newDocument", , method = RequestMethod.POST)
    if (!file.isEmpty()) {
        try {
            byte[] fileContent …
Run Code Online (Sandbox Code Playgroud)

java web-services file-upload multifile-uploader spring-boot

44
推荐指数
3
解决办法
9万
查看次数