multipartFile转化为file
时间: 2023-11-03 17:05:01 浏览: 116
multipartfile转file.txt
multipartFile可以转化为file的几种方式。第一种方式是使用MultipartFile的transferTo()方法,将multipartFile转化为File对象。代码如下:
```java
public File transferToFile(MultipartFile multipartFile) {
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><span class="em">4</span>
阅读全文