use of com.haulmont.cuba.gui.upload.FileUploadingAPI.FileInfo in project cuba by cuba-platform.
the class DesktopFileMultiUploadField method uploadFiles.
protected void uploadFiles(File[] files) {
for (File file : files) {
try {
fireFileUploadStart(file.getName(), file.length());
FileInfo fileInfo = fileUploading.createFile();
UUID tempFileId = fileInfo.getId();
File tmpFile = fileInfo.getFile();
FileUtils.copyFile(file, tmpFile);
filesMap.put(tempFileId, file.getName());
fireFileUploadFinish(file.getName(), file.length());
} catch (Exception ex) {
Messages messages = AppBeans.get(Messages.NAME);
String uploadError = messages.formatMessage(DesktopFileMultiUploadField.class, "multiupload.uploadError", file.getName());
TopLevelFrame topLevelFrame = DesktopComponentsHelper.getTopLevelFrame(this);
topLevelFrame.showNotification(uploadError, Frame.NotificationType.ERROR);
fireFileUploadError(file.getName(), file.length(), ex);
}
}
fireQueueUploadComplete();
}
Aggregations