.getTransferable();
Html5File[] files = transferable.getFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
Html5File file = files[i];
// Max 1 MB files are uploaded
if (file.getFileSize() > 1024 * 1024) {
getMainWindow()
.showNotification(
"File "
+ file.getFileName()
+ " was too large, not transferred to the server side.");
continue;
}
StreamVariable streamVariable = new StreamVariable() {
@Override
public OutputStream getOutputStream() {
return new NullOutputStream();
}
@Override
public boolean listenProgress() {
return true;
}
@Override
public void onProgress(StreamingProgressEvent event) {
System.err.println("Progress"
+ event.getBytesReceived());
}
@Override
public void streamingStarted(
StreamingStartEvent event) {
getMainWindow().showNotification(
"Started uploading "
+ event.getFileName());
}
@Override
public void streamingFinished(
StreamingEndEvent event) {
getMainWindow().showNotification(
"Finished uploading "
+ event.getFileName());
}
@Override
public void streamingFailed(
StreamingErrorEvent event) {
getMainWindow().showNotification(
"Failed uploading "
+ event.getFileName());
}
@Override
public boolean isInterrupted() {
return false;
}
};
file.setStreamVariable(streamVariable);
}
}
}
});