“error”:“upload file controller上不支持的媒体类型”

gudnpqoy  于 2021-07-26  发布在  Java
关注(0)|答案(0)|浏览(247)

我有一个简单的项目,对pdf文件的工作。我试图编码一个文件上传控制器。我尝试了很多方法来做到这一点,但它总是给我这个错误:

Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'multipart/form-data;boundary=----WebKitFormBoundarykuss6O97yqzGx0dG' not supported]

这是我的密码:

@PostMapping (value = "/setTemplateContent", consumes = MediaType.APPLICATION_PDF_VALUE)
@ResponseStatus(HttpStatus.OK)
@ApiOperation(value= "Get contract and pdf. Save Pdf in Contract", notes = "Convert pdf to ByteArray")
@ResponseBody
public void setTemplateContent(@RequestParam("file") MultipartFile file)
        throws IOException {
}

我使用招摇用户界面发送请求。

我甚至尝试从spring的官方指南网站实现“入门”示例。我看不出我的问题在哪里。你能帮我看看我的问题吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题