https://github.com/javadelight/delight-fileupload
A simple wrapper for Apache Commons FileUpload to use it with Netty and other IO servers
https://github.com/javadelight/delight-fileupload
commons-fileupload netty
Last synced: 7 months ago
JSON representation
A simple wrapper for Apache Commons FileUpload to use it with Netty and other IO servers
- Host: GitHub
- URL: https://github.com/javadelight/delight-fileupload
- Owner: javadelight
- License: other
- Created: 2016-02-25T03:31:04.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2025-06-21T09:26:40.000Z (7 months ago)
- Last Synced: 2025-06-21T10:28:47.916Z (7 months ago)
- Topics: commons-fileupload, netty
- Language: Java
- Size: 68.4 KB
- Stars: 11
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.TXT
Awesome Lists containing this project
README
# delight-fileupload
A simple wrapper for [Apache Commons FileUpload](https://commons.apache.org/proper/commons-fileupload/) for allowing it
to work with Netty and other IO servers.
Part of the [Java Delight Suite](http://javadelight.org).
## Dependency
Just add the following dependency to your projects.
```xml
org.javadelight
delight-fileupload
[insert latest version]
```
This artifact is available on [Maven Central](https://search.maven.org/#search%7Cga%7C1%7Cdelight-fileupload) and
[BinTray](https://bintray.com/javadelight/javadelight/delight-fileupload).
[](https://search.maven.org/#search%7Cga%7C1%7Cdelight-fileupload)
Please note in order to use this package, the `javax.servlet` dependency needs to be defined in your project as well. Such as:
```xml
javax.servlet
javax.servlet-api
3.1.0
```
## Usage
First obtain the raw data of the request in the framework you are using:
```java
byte[] data = ... posted data
String contentType = ... header "Content-Type"
```
Then call customized FileUpload to process the request:
```java
FileItemIterator iterator = FileUpload.parse(data, contentType);
```
Finally, process the items in the multipart request:
```java
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 ...
}
}
```