Multi-upload files
We have implemented multi-file upload. You can use a dedicated drag-and-drop zone or a standard button to select your files.
This feature supports the following types:
This feature supports only field fileUpload
The interface supports three distinct modes for displaying the bulk file upload functionality, allowing for flexible user experience configuration:
- Combined Mode (Button + Multi-upload) Live Sample GitHub
This mode displays both a button to trigger the upload dialog and a drag-and-drop widget, giving the user maximum choice in how they initiate the upload.
- Button-Only Mode (Button) Live Sample GitHub
This mode is designed to display only a button. Clicking it opens the operating system's standard file selection dialog for bulk uploading files.
- Widget-Only Mode (Multi-upload files) This mode displays only the interactive drag-and-drop upload widget, without a separate button.
How does it look?




There are five main colors used for the progress bar and icon:
- light gray — empty progress bar
- blue — upload in progress
- green — upload completed successfully
- red — an error occurred
- dark gray — file skipped and will not be uploaded (the reason can be viewed by hovering over the progress row)





Uploaded:
- If all files are uploaded successfully, the progress notification automatically disappears after 5 seconds.
- If some files are skipped, the notification remains visible until it is closed manually or the user navigates to another screen. Information about successfully uploaded files still disappears after 5 seconds.
- When hovering over a notification, it will not disappear until the mouse is moved away (successful notifications also remain visible in this case)
- Limitation: When navigating to another screen, the notification is hidden and the upload is canceled

Info
For fields of type fileUpload, there is an option to cancel the upload: if a new file is added while the previous one is still uploading, the previous upload is canceled.
How to add?
Example
Step1 Add actionKey associate to corresponding .widget.json.
{
"name": "myexamplealllist",
"title": "List",
"type": "List",
"bc": "myexample",
"fields": [
{
"title": "Custom Field File",
"key": "customFieldFile",
"type": "fileUpload",
"fileIdKey": "customFieldFileId"
}
],
"options": {
"buttons": [
{
"actionKey": "associate",
"fieldKey": "customFieldFile",
"mode": "default-and-file-upload-dnd"
}
],
"actionGroups": {
"include": [
"create",
"associate",
"delete",
"save"
]
}
}
}
Step1 Add actionKey associate to corresponding .widget.json.
{
"name": "myexamplefilelist",
"title": "List",
"type": "List",
"bc": "myexample",
"fields": [
{
"title": "Custom Field File",
"key": "customFieldFile",
"type": "fileUpload",
"fileIdKey": "customFieldFileId"
}
],
"options": {
"buttons": [
{
"actionKey": "associate",
"fieldKey": "customFieldFile",
"mode": "file-upload-dnd"
}
],
"actionGroups": {
"include": [
"create",
"associate",
"delete",
"save"
]
}
}
}
Step1 Add actionKey associate to corresponding .widget.json.
{
"name": "myexampledefaultlist",
"title": "List",
"type": "List",
"bc": "myexample",
"fields": [
{
"title": "Custom Field File",
"key": "customFieldFile",
"type": "fileUpload",
"fileIdKey": "customFieldFileId"
}
],
"options": {
"buttons": [
{
"actionKey": "associate",
"fieldKey": "customFieldFile",
"mode": "default"
}
],
"actionGroups": {
"include": [
"create",
"associate",
"delete",
"save"
]
}
}
}
Step1 Add actionKey associate to corresponding .widget.json.
{
"name": "myexamplecardlist",
"title": "CardList",
"type": "CardList",
"bc": "myexample",
"fields": [
{
"title": "Custom Field File",
"key": "customFieldFile",
"type": "fileUpload",
"fileIdKey": "customFieldFileId",
"preview": {
"enabled": true,
"mode": "inline"
}
}
],
"options": {
"buttons": [
{
"actionKey": "associate",
"fieldKey": "customFieldFile",
"mode": "default-and-file-upload-dnd"
}
],
"actionGroups": {
"include": [
"associate",
"delete"
]
}
}
}
Step2 Add setFileAccept to corresponding FieldMetaBuilder.
@Override
public void buildIndependentMeta(FieldsMeta<MyExampleDTO> fields, InnerBcDescription bcDescription, Long parentId) {
fields.setEnumFilterValues(fields, MyExampleDTO_.customFieldDictionary, CustomFieldDictionaryEnum.values());
fields.enableFilter(MyExampleDTO_.customFieldDictionary);
fields.enableFilter(MyExampleDTO_.customFieldFile);
fields.setFileAccept(MyExampleDTO_.customFieldFile, List.of(".png", ".pdf", ".jpg", ".jpeg"));
}
Step3 Add associate to corresponding ResponseService.
.associate(ast -> ast
.withCustomParameter(Map.of("subtype", "multiFileUpload"))
.text("Add Files"))
@Override
public Actions<MyExampleDTO> getActions() {
return Actions.<MyExampleDTO>builder()
.save(sv -> sv.text("Save"))
.create(crt -> crt.text("Create"))
.cancelCreate(ccr -> ccr.text("Cancel").available(bc -> true))
.delete(dlt -> dlt.text("Delete"))
.associate(ast -> ast
.withCustomParameter(Map.of("subtype", "multiFileUpload"))
.text("Add Files")
)
.build();
}
Step3.1 Add doAssociate to corresponding ResponseService.
In this service, it is necessary to describe what happens to the files during multiple upload, as well as how and with which properties they are stored.
@Override
protected AssociateResultDTO doAssociate(List<AssociateDTO> data, BusinessComponent bc) {
List<MyEntity> meetingDocuments = fileUpload(bc, data);
List<MyExampleDTO> collect = meetingDocuments.stream().map(e -> entityToDto(bc, e))
.collect(Collectors.toList());
return new AssociateResultDTO((List) collect);
}
Step3.2 Add function fileUpload to corresponding ResponseService.
@SneakyThrows
private List<MyEntity> fileUpload(BusinessComponent bc, List<AssociateDTO> fileIds) {
List<MyEntity> myEntityList = new ArrayList<>();
for (AssociateDTO item : fileIds) {
var myEntity = new MyEntity();
var fileId = item.getId();
FileDownloadDto download = cxboxFileService.download(fileId, null);
myEntity.setCustomFieldFileId(fileId);
myEntity.setCustomFieldFile(download.getName());
myEntityList.add(repository.save(myEntity));
}
return myEntityList;
}
Action
Work in progress
The button and the drag-and-drop zone first upload the chosen files, then run one action for all of them on the backend. The backend decides what to do with the files: for example, create a row for each file and fill its fields, or reject the files with a message.
Availability
When adding files is not allowed, the button is hidden, and the drag-and-drop zone stays in its place but turns gray and does not accept files.
For example, documents can be added to a task only while the task is open. When the task status is "Closed", the "Add Files" button is hidden and the drag-and-drop zone is gray.
How does it look?



How to add?
Example
Step1 Add available to the action in corresponding ResponseService.
.associate(ast -> ast
.withCustomParameter(Map.of("subtype", "multiFileUpload"))
.text("Add Files")
.available(this::isTaskOpen))
@Override
public Actions<MyExampleDTO> getActions() {
return Actions.<MyExampleDTO>builder()
.save(sv -> sv.text("Save"))
.create(crt -> crt.text("Create"))
.cancelCreate(ccr -> ccr.text("Cancel").available(bc -> true))
.delete(dlt -> dlt.text("Delete"))
.associate(ast -> ast
.withCustomParameter(Map.of("subtype", "multiFileUpload"))
.text("Add Files")
.available(this::isTaskOpen)
)
.build();
}
private boolean isTaskOpen(BusinessComponent bc) {
return repositoryParent.findById(bc.getParentIdAsLong())
.map(task -> task.getStatus() != StatusEnum.CLOSED)
.orElse(false);
}
see more Actions
Upload errors
Available since v3.0.2
When the upload of a file fails, the tooltip of its line in the Upload progress window shows the reason. Each file gets its own text, so the user sees what happened to each file. The same works for a single file uploaded to a fileUpload field.
The text is taken from the answer of the file controller:
errorMessage- any exception of the backend (500);error.popup-BusinessException(418). A popup is not meant for upload errors, so a warning is also written to the browser console. The same is done for a download, see Download progress.
Each message of the answer is shown on its own line. A long error (for example, with a stack trace) does not go beyond the screen: the tooltip is not higher than 300 px and the text is scrolled inside it. The tooltip stays open while the mouse is on the line of the file or on the tooltip itself.
If the answer has no text of the application, the standard text is shown: for example, 502 Bad Gateway of a proxy, a network error or a cancelled request.
How does it look?



PostAction
Work in progress