com.github.zw201913:fileupload

file upload

License

License

GroupId

GroupId

com.github.zw201913
ArtifactId

ArtifactId

fileupload
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

com.github.zw201913:fileupload
file upload
Project URL

Project URL

https://github.com/zw201913/fileupload
Source Code Management

Source Code Management

https://github.com/zw201913/fileupload

Download fileupload

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.zw201913/fileupload/ -->
<dependency>
    <groupId>com.github.zw201913</groupId>
    <artifactId>fileupload</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.zw201913/fileupload/
implementation 'com.github.zw201913:fileupload:1.0.0'
// https://jarcasting.com/artifacts/com.github.zw201913/fileupload/
implementation ("com.github.zw201913:fileupload:1.0.0")
'com.github.zw201913:fileupload:jar:1.0.0'
<dependency org="com.github.zw201913" name="fileupload" rev="1.0.0">
  <artifact name="fileupload" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.zw201913', module='fileupload', version='1.0.0')
)
libraryDependencies += "com.github.zw201913" % "fileupload" % "1.0.0"
[com.github.zw201913/fileupload "1.0.0"]

Dependencies

compile (21)

Group / Artifact Type Version
commons-fileupload : commons-fileupload jar 1.3.3
javax.servlet : jstl jar 1.2
org.apache.commons : commons-lang3 jar 3.6
org.projectlombok : lombok jar 1.16.16
com.alibaba : fastjson jar 1.2.32
org.apache.logging.log4j : log4j-api jar 2.8.2
org.apache.logging.log4j : log4j-core jar 2.8.2
org.apache.logging.log4j : log4j-web jar 2.8.2
org.springframework : spring-webmvc jar 4.3.8.RELEASE
org.springframework : spring-web jar 4.3.8.RELEASE
org.springframework : spring-context jar 4.3.8.RELEASE
org.springframework : spring-beans jar 4.3.8.RELEASE
org.springframework : spring-tx jar 4.3.8.RELEASE
org.springframework : spring-aop jar 4.3.8.RELEASE
cglib : cglib jar 3.2.5
org.springframework : spring-core jar 4.3.8.RELEASE
org.springframework : spring-expression jar 4.3.8.RELEASE
org.aspectj : aspectjrt jar 1.8.10
org.aspectj : aspectjweaver jar 1.8.10
com.fasterxml.jackson.core : jackson-core jar 2.8.8
com.fasterxml.jackson.core : jackson-databind jar 2.8.8

provided (1)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.1.0

Project Modules

There are no modules declared in this project.

fileupload

文件上传组件

下载fileupload-0.0.1-20171012.092803-7.jar包放到你的项目中 或通过maven管理

<dependency>
    <groupId>com.github.zw201913</groupId>
    <artifactId>fileupload</artifactId>
    <version>1.0.0</version>
</dependency>
  1. 只需要使用@FileUpload这个注解,就可以完成文件的上传存储。

  2. @FileUpload这个直接可以同时在方法和参数上使用,示例如下:

        @ResponseBody
    @FileUpload(digest=true)
    @RequestMapping(value = "/fileUp1", method = RequestMethod.POST)
    public String bigFileUpload1(@RequestPart("param") Param param,
    @RequestPart("files1")@FileUpload(digest=false)MultipartFile[] files1,  
    @RequestPart("files2") MultipartFile[] files2, UploadResults result){
     //实现业务
     }
    

@FileUpload直接中有两个参数,第一个参数digest设置上传的文件是否需要做摘要,默认是不做摘要;第二个参数autoSave设置文件是否自动保存,默认是自动保 存。

  1. UploadResults为文件上传成功后的结果,可以通过getGroup("前端指定的key值")获取指定的上传结果。示例中就可以通过getGroup("files1")和getGroup("files2")分别获取两组文件上传的结果。

  2. 需要在配置文件中设置fileSaveDir文件保存路径,该配置文件需要通过spring mvc读入。

  3. 在spring mvc配置文件中配置切面

    <bean id="fileAspect" class="com.github.zw201913.aspect.FileAspect"></bean>
    <aop:config>
       <aop:aspect id="time" ref="fileAspect">
    <aop:pointcut id="fileuploadPointCut"
     		expression="设置切面" />
     	<aop:around method="upload" pointcut-ref="fileuploadPointCut" />
     </aop:aspect>
     </aop:config>
    

Versions

Version
1.0.0