当前位置:网站首页>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;
}
边栏推荐
- 微信公众号开发 获取openid时报错40029 invalid code 问题的解决
- Analysis of C # delegation and anonymous method
- Many people don't know whether they are looking for Kanban software or Kanban software
- nmap弱点扫描结果可视化转换
- Bash shell学习笔记(三)
- Sword finger offer (49): convert a string to an integer
- 对面向抽象编程的理解
- @JsonFormat和@DateTimeFormat的区别和使用
- 菜鸟看源码之LinkedBlockingQueue
- 回到顶部的几种方案(js)
猜你喜欢

0x00007FFD977C04A8 (Qt5Sqld.dll)处(位于 a.exe 中)引发的异常: 0xC0000005: 读取位置 0x0000000000000010 时发生访问冲突

Visual conversion of nmap vulnerability scanning results

Bash shell学习笔记(六)
![[dectectron2] follow the official demo](/img/aa/03e46897234c309415b336ac39b7d9.png)
[dectectron2] follow the official demo

菜鸟看源码之HashTable

菜鸟看源码之LinkedBlockingQueue

Tutorial of putty

Traversal recursion + iteration of binary tree

Capture ZABBIX performance monitoring chart with selenium

ESXi6.5补丁更新
随机推荐
Why do I need automated testing? Software testers take you to evaluate different software testing tools
@Notblank, @notnull, @notempty differences and uses
MFC多线程的简单使用
1748.唯一元素的和
10 let operator= return a reference to *this
BigDecimal's addition, subtraction, multiplication and division, size comparison, rounding up and down, and BigDecimal's set accumulation, judge whether BigDecimal has decimal
企鹅龙(DRBL)无盘启动+再生龙(clonezilla)网络备份与还原系统
Bash shell learning notes (II)
px2rem-loader将px转化为rem,适配移动端vant-UI等框架
Koin
@NotBlank、@NotNull 、@NotEmpty 区别和使用
Constructors, method overloads, object arrays, and static
Disable usbjatg in Altium Designer
为什么需要自动化测试?软件测试师带你测评不同软件测试工具
C language pengge 20210812c language function
Pengge C language lesson 4 (3)
1837.K进制表示下的各位数字总和
微信公众号开发 获取openid时报错40029 invalid code 问题的解决
【小程序】onReachBottom 事件为什么不能触发 ?(一秒搞定)
SCADA和三大工业控制系统PLC、DCS、FCS