Directory

← Back

EasyUploads

Use file uploads as fields in Form, upload multiple files at once - easily!

Author

Contributors

Rating

The default Upload component in Vaadin is a powerful tool, but its rather low level API is sometimes hard to use for simple tasks.

EasyUploads add-on contains wrappers to simplify usage of the Upload component.

  • UploadField provides easier API for developer to access the uploaded file contents or the File object where the contents was streamed. It also implements full Field API, making it possible to use it with automatic data binding using Binder to properties of type byte[].

  • ImagePreviewField an extension of the above to store an image to byte array (e.g. Lob in DB) and which provides built in preview for the image.

  • MultiFileUpload is a helper for uploading multiple files. When a file is selected by the end user the upload is immediately started and MultiFileUpload is ready to select another file (while previous one(s) are still being uploaded). Since 0.2 one can also select multiple files with the OS dialog or by dragging files from OS to a "drop zone". Since 0.3 (0.4 for IE) users can also select multiple files at once using the OS dialog (aka. ctrl/shift-click).

Both components contain built in support for ProgressIndigator, giving nice feedback for end user without requiring boiler plate code from Vaadin developer.

This is an open source product. All contributions (code, documentation, tutorials, bug reports, enhancement suggestions) are more than welcome. Use the project page for contributions, Vaadin forum or Pro Account for help requests.

Note that the addon version 8.0.x needs Vaadin 7 compatibility code as well. Thus, you'll need to add following dependency as well (not required from 9.0.0 forward):

<dependency>
   <groupId>com.vaadin</groupId>
   <artifactId>vaadin-compatibility-client</artifactId>
   <scope>provided</scope>
</dependency>

Sample code

		final UploadField uploadField = new UploadField();

		Button b = new Button("Show value");
		b.addListener(new Button.ClickListener() {
			public void buttonClick(ClickEvent event) {
				byte[] value = uploadField.getValue();
				mainWindow.showNotification("Value:" + value);
			}
		});

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Several improvements contributed by "StEwert.con"

Released
2013-03-16
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.0+
Vaadin 6.5+ in 0.2.0
Vaadin 6.6+ in 0.4.7
Vaadin 6.8+ in 0.5.3
Vaadin 7.0+ in 7.0.0
Vaadin 8.0+ in 8.0.0
Browser
Browser Independent
Online