org.springframework.web.multipart.MultipartException: Current request is not a multipart reques如何解决
时间: 2023-12-21 08:02:45 浏览: 277
org.springframework.web.multipart.MultipartException: Current request is not a multipart request报错的解决方案是确保你的请求是一个multipart请求。通常这个错误是由于缺少enctype="multipart/form-data"导致的。你需要在表单中添加这个属性,如下所示:
<form action="/upload" method="post" enctype="multipart/form-data">
<!--multiple:可以选择多个文件 -->
<input type="file" name="photos" multiple >
</form>
加上这个属性后,就不会再报错了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [org.springframework.web.multipart.MultipartException: Current request is not a multipart request](https://blog.csdn.net/qq_56769991/article/details/123723706)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [文件上传org.springframework.web.multipart.MultipartException: Current request is not a multipart ...](https://blog.csdn.net/weixin_45843025/article/details/120238960)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文