Attachments - UploadFile
Component for attaching files to the application

Component properties
Maximum number of attached files (section Basic properties)
numberOfUploadingFiles
The number of files that can be uploaded in the component, default is 1.
Number of required attachments (section Data quality)
requiredCount
The required number of files to attach - default is 0. If 0, then no file needs to be attached; if more, then it depends on the given number.
Text displayed when required attachments are missing (section Data quality)
requiredCountError
Requiredness message, required if the property Number of required attachments (requiredCount).
Maximum file size (section Data quality)
maxFileSize
Maximum file size in KB. Default is 1024 KB.
Maximum total size of all files (section Data quality)
maxTotalFilesSize
Maximum size of all attached files in KB. Default is 10240 KB.
Show the list of available extensions (section Interactions)
showExtensionList
Enables the option to display information about allowed formats and the maximum size of the attached file (by default, the option is disabled). Example information: "Allowed attachment formats: pdf (max. 1 MB)"
Enable image compression (section Interactions)
imageCompressionEnabled
Option to compress images (default value "false").
Maximum width of a camera photo (section Interactions)
maxWebcamWidth
Feature availability depends on the license and may not be available in all deployments. Maximum width of a camera photo in pixels.
Maximum height of a camera photo (section Interactions)
maxWebcamHeight
Feature availability depends on the license and may not be available in all deployments. Maximum height of a camera photo in pixels.
Option to attach a photo taken with a camera (section Interactions)
webcamEnabledCondition
Feature availability depends on the license and may not be available in all deployments. Condition enabling/disabling the ability to upload a photo taken with the camera built into the device.
List of allowed file extensions (section Security)
validExtensionList
Formats of allowed file extensions, separated by commas, e.g.: jpg, jpeg, png, pdf.
Additional validation of PDF files (section Security)
validateContent
Additional validation of the file in terms of PDF FORMAT, not just the extension itself.
Rejecting encrypted PDF, DOC, DOCX, XLS, XLSX files (section Security)
rejectEncrypted
Rejecting files (PDF, DOC, DOCX, XLS, XLSX) if they are password-encrypted.
Regular expression for validating the file name (section Security)
allowedFilenameRegexp
Regular expression checking allowed file names. It is possible to override the default validation error message by adding the key iew.gwtupload.invalid_filename and setting a new translation value.
Whitelist of characters (section Security)
extraWhitelistCharacters
To allow uploading files containing non-standard characters, add them to the whitelist of allowed characters. E.g.: (). This configuration extends the webforms.xml configuration ...
Option to attach descriptions to attached files (section Other)
attachmentWithDescription
Feature availability depends on the license and may not be available in all deployments. Displays a description field for each added attachment. By default, the property is disabled (set to "false").
Maximum number of characters in descriptions of attached files (section Other)
attachmentDescriptionMaxLength
Feature availability depends on the license and may not be available in all deployments. Maximum length of the description that can be entered for the added attachment. Default is 120 characters.
Button label (section Other)
buttonLabel
Feature availability depends on the license and may not be available in all deployments. Text displayed on the add file button.
Field description (section Other)
description
Feature availability depends on the license and may not be available in all deployments. Description text.
Enable image compression (section Other)
Feature availability depends on the license and may not be available in all deployments. Property allowing attached images to be reduced.
Document type - advanced integration (section Other)
documentType
Technical field used in advanced integration (requires additional implementation). Feature availability depends on the license and may not be available in all deployments.
Contact number - advanced integration (section Other)
contractNumber
Technical field used in advanced integration (requires additional implementation). Feature availability depends on the license and may not be available in all deployments.
Process type (section Other)
processType
Process name passed to the service saving the attached file in an external resource. Feature availability depends on the license and may not be available in all deployments.
Calling an external validator for the added file
singleFileValidator
Calling an external validator for the added file. The validator is called when attempting to add each file (if the attachment does not pass validation, it is rejected). The property should be added from the XML Source level.
More information about component properties: Common component properties
Using the component
Adding a file
To import a file using the component Attachments, click the button Add file. The system file selection window will then open. After selecting a file, it will be imported. After the import is complete, the file name will appear on the list.
Deleting a file
Imported files can be deleted by clicking the button Delete visible next to the file name.


To the component Attachments you can attach a file with any extension.
Description for attached files
Availability of functionality depends on the license and may not be available in all deployments.
A description can be added to the attached file. To do this, select the field Option to attach descriptions to attached files (attachmentWithDescription) (by default, the field is disabled). The length of the added description can be set in the field Maximum number of characters in descriptions of attached files (attachmentDescriptionMaxLength).
Component input parameters
maxFileSize
Maximum file size in bytes
validExtensionList
List of allowed extensions (one extension per line)
maxWebcamWidth
Maximum width of a camera photo in pixels
maxWebcamHeight
Maximum height of a camera photo in pixels
Component output parameters
totalFilesSize
Sum of the sizes of all files added using the uploader component
fileNames
Retrieving the names of files added to the control. Data is returned in JSON format: ["fileName1", "fileName2", ...]
externalIds
File identifiers from the external service, similarly to above, are returned in JSON format.
If we want to display the sum of the sizes of all files in a component, e.g. a Text field, we can do so using the property DATA SOURCE FROM ANOTHER FIELD (valueSourceId) of the component that is to display the value. For this purpose, the property DATA SOURCE FROM ANOTHER FIELD we assign the following value: GesUploadFile1$totalFilesSize where GesUploadFile1 is the identifier of the attachment component, while totalFilesSize is a property of this component whose value will be entered. Copying the value additionally requires listening to the attachment component.
Defining a component clearing action
For the component, it is possible to define in the main application template an action clearing the attached file from the component. More information in Actions.
Demo application: demoUploadFile
Last updated
Was this helpful?
