(转)SpringBoot实现MultipartFile文件上传
转:SpringBoot实现MultipartFile文件上传 - 云+社区 - 腾讯云 (tencent.com)
1、SpringBoot采用FileUpload组件实现上传处理,在控制器中可以使用MultipartFile类进行接收。
1 <?xml version="1.0" encoding="UTF-8"?>
2 ="http://maven.apache.org/POM/4.0.0"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5 https://maven.apache.org/xsd/maven-4.0.0.xsd">
6 >4.0.0</modelVersion>
7 >
8 >org.springframework.boot</groupId>
9 >spring-boot-starter-parent</artifactId>
10 >2.3.5.RELEASE</version>
11 /> <!-- lookup parent from repository -->
12 </parent>
13 >com.example</groupId>
14 >demo</artifactId>
15 >0.0.1-SNAPSHOT</version>
16 >demo</name>
17 >Demo project for Spring Boot</description>
18
19 >
20 .version>1.8</java.version>
21 -jar-plugin.version>3.1.1</maven-jar-plugin.version>
22 </properties>
23
24 >
25 >
26 >org.springframework.boot</groupId>
27 >spring-boot-starter-web</artifactId>
28 </dependency>
29
30 >
31 >org.springframework.boot</groupId>
32 >spring-boot-starter-test</artifactId>
33 >test</scope>
34 >
35 >
36 >org.junit.vintage</groupId>
37 >junit-vintage-engine</artifactId>
38 </exclusion>
39 </exclusions>
40 <