2 Star 4 Fork 3

陈霓清 / fileupload上传工具包

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

fileupload

Local upload file, supporting relative path and absolute path

@PostMapping("upload")
@ResponseBody
public Result upload(HttpServletRequest request, MultipartFile file) {
	
	/**
	 * uploadPath可以是绝对路径 或 相对路径
	 *      绝对路径:D:\\test  或   /opt/upload
	 *      相对路径:upload    相对路径上传的文件会在项目同级目录生成的文件夹中
	 */
	String uploadPath = "upload";

	Map<String, Object> map = null;

	try {
		map = UploadUtils.uploadImage(file, uploadPath);
	} catch (FileFormatException e) {
		e.printStackTrace();    // 不支持的文件格式
	} catch (FileSizeException e) {
		e.printStackTrace();    // 文件大小超过限制
	} catch (UploadException e) {
		e.printStackTrace();    // 上传出错
	} catch (Exception e) {
		e.printStackTrace();
	}

	if (map!=null) {
		System.out.println(map);
	}
	
	return Result.success();
}

javaex

安装

<dependency>
	<groupId>cn.javaex</groupId>
	<artifactId>fileupload</artifactId>
	<version>1.1.2</version>
</dependency>

<!-- 如果是基于spring的web项目,则下面2个依赖可以不用引入 -->
<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>javax.servlet-api</artifactId>
	<version>4.0.1</version>
	<scope>provided</scope>
</dependency>
<dependency>
	<groupId>org.springframework</groupId>
	<artifactId>spring-webmvc</artifactId>
	<version>4.3.7.RELEASE</version>
	<scope>provided</scope>
</dependency>

插件文档地址

http://doc.javaex.cn/fileupload

官网

http://www.javaex.cn

Comments ( 2 )

Sign in for post a comment

About

上传文件到本地服务器,支持绝对路径和相对路径 spread retract
Java
Apache-2.0
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
Java
1
https://gitee.com/javaex/fileupload.git
git@gitee.com:javaex/fileupload.git
javaex
fileupload
fileupload上传工具包
master

Search