上传文件报错:The current request is not a multipart request] with root cause

上传文件时报错:The current request is not a multipart request] with root cause

解决:在

标签加上  :  enctype="multipart/form-data"  

参考:

上传文件的表单中要加属性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.com/questions/43936372/upload-file-springboot-required-request-part-file-is-not-present

https://stackoverflow.com/questions/46071811/required-request-part-file-is-not-present-after-form-submission-in-spring-boot

https://stackoverflow.com/questions/42040261/missingservletrequestpartexception-required-request-part-file-is-not-present


你可能感兴趣的:(bootstrap,Java笔记)