1,创建springboot项目
步骤就不用贴了。
2,导入相关的依赖:
以下是上传用到的依赖
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
3,创建HTML页面
<html>
<head>
<title>测试</title>
</head>
<body>
<form action="/uploadFile" enctype="multipart/form-data" method="post">
<label>上传文件</label>
<input type="file" name="file" multiple="multiple"/>
<input type="submit" value="上传"/>
</form>