MultipartFile[] file
时间: 2023-10-17 11:35:18 浏览: 133
MultipartFile转File有多种方式可以实现。其中一种方式是使用Spring提供的MultipartFile的transferTo()方法将MultipartFile转换为File对象。具体操作如下所示:
```java
public File transferToFile(MultipartFile multipartFile) {
// 选择用缓冲区来实现这个转换即使用java创建的临时文件使用MultipartFile.transferto()方法。
File file = null;
try {
String originalFilename = multipartFile.getOriginalFilename();
String[] filename = originalFilename.split("\\.");
file=File.createTempFile(filename<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [File 与 MultipartFile概述](https://blog.csdn.net/weixin_44874132/article/details/125471482)[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_1"}}] [.reference_item style="max-width: 50%"]
- *3* [MultipartFile 转File的几种方式](https://blog.csdn.net/qq_42383970/article/details/120201524)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文