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/43936372/upload-file-springboot-required-request-part-file-is-not-present

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