admin管理员组文章数量:1612097
上传文件时报错:The current request is not a multipart request] with root cause
解决:在<form>标签加上 : enctype="multipart/form-data"
参考:
上传文件的表单中<form>要加属性enctype="multipart/form-data",如果不写enctype属性时,也默认为其添加了enctype属性值,默认值是enctype="application/x- www-form-urlencoded"
上传文件报错:upload file springboot Required request part 'file' is not present
长传文件报错:Required request part 'file' is not present
解决:1、请查看参数名称等是否匹配;
2、@RequestMapping注解加上:consumes = "multipart/form-data",如下:
@RequestMapping(value = "/form", method = RequestMethod.POST, consumes = "multipart/form-data")
public String handleFormUpload(@RequestPart("file") MultipartFile
file)
https://stackoverflow/questions/46071811/required-request-part-file-is-not-present-after-form-submission-in-spring-boot
https://stackoverflow/questions/42040261/missingservletrequestpartexception-required-request-part-file-is-not-present
本文标签: 报错上传文件Currentrootmultipart
版权声明:本文标题:上传文件报错:The current request is not a multipart request] with root cause 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1728630119a1166987.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论