当前位置:网站首页>Multipartfil to file
Multipartfil to file
2022-07-26 10:53:00 【Eric-x】
/** * MultipartFile Convert to File file * * @param multipartFile * @return */
public final static File transferToFile(MultipartFile multipartFile) {
// Choose to implement this transformation with a buffer, that is, use java Temporary files created Use MultipartFile.transferto() Method .
File file = null;
try {
String originalFilename = multipartFile.getOriginalFilename();
// Get file suffix
String prefix = originalFilename.substring(originalFilename.lastIndexOf("."));
file = File.createTempFile(originalFilename, prefix); // Create temporary file
multipartFile.transferTo(file);
// Delete
file.deleteOnExit();
} catch (IOException e) {
e.printStackTrace();
}
return file;
}
边栏推荐
- 27.移除元素
- Drbl diskless startup + Clonezilla network backup and restore system
- 使用float实现左中右布局,中间内容自适应
- Bash shell learning notes (II)
- 20210807 1 c language program structure
- SCADA和三大工业控制系统PLC、DCS、FCS
- @The difference and use of jsonformat and @datetimeformat
- During the interview, how did the interviewer evaluate the level of rust engineers?
- @The real difference and usage between validated and @valid
- Wechat official account message notice "errCode": 40164, "errmsg": "invalid IP
猜你喜欢

使用Selenium抓取zabbix性能监控图

Kali view IP address

$router和$route的区别

Flutter编译报错 version of NDK matched the requested version 21.0.6113669. Versions available locally: 2

Bash shell learning notes (II)

Software Testing Overview: the background, essence and process of software testing

为什么需要自动化测试?软件测试师带你测评不同软件测试工具

Drbl diskless startup + Clonezilla network backup and restore system

Codepoint 58880 not found in font, aborting. flutter build apk时报错

0x00007ffd977c04a8 (qt5sqld.dll) (in a.exe): 0xc0000005: an access violation occurred when reading position 0x0000000000000010
随机推荐
用两个栈实现队列
Flutter jni混淆 引入.so文件release包闪退
使用定位实现左中右布局,中间内容自适应
Sword finger offer (53): a string representing a numeric value
Fragment 懒加载
$router和$route的区别
c 语言中宏参数的字符串化跟宏参数的连接
回到顶部的几种方案(js)
MFC多线程的简单使用
Sql Server 数据库之初学体验
2021-08-13 learn C language with pengge - array
10 let operator= return a reference to *this
Sword finger offer (twenty): stack containing min function
Pengge C language sixth class
27.移除元素
px2rem-loader将px转化为rem,适配移动端vant-UI等框架
Capture ZABBIX performance monitoring chart with selenium
Pengge C language 20210811 program structure operation
软件测试综述之软件测试的背景、实质、软件开发的过程
RT thread learning notes (III) -- building a compilation environment with scons