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

上传文件时报错: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.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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值