delight-fileupload

A simple wrapper for Apache Commons FileUpload to use it with Netty and other IO servers.

License

License

GPL
GroupId

GroupId

org.javadelight
ArtifactId

ArtifactId

delight-fileupload
Last Version

Last Version

0.0.5
Release Date

Release Date

Type

Type

bundle
Description

Description

delight-fileupload
A simple wrapper for Apache Commons FileUpload to use it with Netty and other IO servers.
Project URL

Project URL

https://github.com/javadelight/delight-fileupload
Source Code Management

Source Code Management

https://github.com/javadelight/delight-fileupload

Download delight-fileupload

Dependencies

compile (2)

Group / Artifact Type Version
commons-fileupload : commons-fileupload jar 1.3.3
junit : junit jar 4.7

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.

Build Status

delight-fileupload

A simple wrapper for Apache Commons FileUpload for allowing it to work with Netty and other IO servers.

Part of the Java Delight Suite.

Dependency

Just add the following dependency to your projects.

<dependency>
    <groupId>org.javadelight</groupId>
    <artifactId>delight-fileupload</artifactId>
    <version>[insert latest version]</version>
</dependency>

This artifact is available on Maven Central and BinTray.

Maven Central

Usage

First obtain the raw data of the request in the framework you are using:

byte[] data = ... posted data

String contentType = ... header "Content-Type"

Then call customized FileUpload to process the request:

FileItemIterator iterator = FileUpload.parse(data, contentType);

Finally, process the items in the multipart request:

while (iter.hasNext()) {
    FileItemStream item = iter.next();

    if (item.isFormField()) {
        ... some fields in the form
    } else {
        InputStream stream = item.openStream();
        // work with uploaded file data by processing stream ...
    }

}

Versions

Version
0.0.5
0.0.4
0.0.3