FileUploader
The FileUploader ctrl enables the user to upload files inside the Form.
<div
id="fileuploader-ctrl"
data-hf-control="FileUploader"
data-hf-options="{
label: 'File Uploader',
required: true,
maxFileUploads: 10,
allowedFormats: ['pdf', 'jpeg', 'jpg', 'png'],
descriptionStart: 'Here you can upload your documents.',
descriptionEnd: '<div class=\'custom-class\'><small>Only PDF, JPEG and PNG files allowed. <br> (Minimum file size: 10 KB, maximum file size: 5 MB, at most 7 files).</small></div>',
minFileSizeKb: 100,
maxFileSizeKb: 5000,
minImagePixel: 10,
maxImagePixel: 5000,
buttonLabel: 'Add file',
deleteOnNotFullfilledCondition: false
}"
></div>
FormControl Options
allowedCharacters
Set the allowed characters for the filename. If not set, the media settings whitelist property or the Form settings whitelist property is used (in this order). If none of these properties is set, all characters are allowed.
How to use:
allowedCharacters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789Type:
stringallowedCharactersRegExp
Set the allowed characters for the filename in RegExp-format. If not set, the media settings whitelist property or the Form settings whitelist property is used (in this order). If none of these properties is set, all characters are allowed.
How to use:
allowedCharactersRegExp: [a-zA-Z0-9]Type:
stringallowedFormats
Define the allowed file formats by listing the file extensions.
How to use:
allowedFormats: ['pdf', 'jpeg', 'jpg', 'png']Type:
string[]buttonLabel
Provide an individual button label string.
How to use:
buttonLabel: 'Add file'Type:
stringdeleteOnNotFullfilledCondition
De/activate deletion of attachments on not fullfilled conditions.
How to use:
deleteOnNotFullfilledCondition: falseType:
booleanDefault:
truedescriptionEnd
Provide an additional information placed beyond the "file list". (Plain text or restricted HTML text)
How to use:
descriptionEnd: '<div class='custom-class'><small>Only PDF, JPEG and PNG Dateien allowed. <br> (Minimum file size: 5 KB, maximum file size: 5 MB, at most 7 files).</small></div>'Type:
stringdescriptionStart
Provide a short intro text. (Plain text or restricted HTML text)
How to use:
descriptionStart: 'Hier können Sie ihre Unterlagen hochladen.'Type:
stringdoNotCopy
Set "true" whenever the field should be cleared if the Form is copied.
How to use:
doNotCopy: trueType:
booleanmaxDurationSec
Define the maximum duration of an audio or video file (other file types ignore this config).
How to use:
maxDurationSec: 120Type:
numbermaxFilenameLength
Define the maximum length of a filename.
How to use:
maxFilenameLength: 100Type:
numberDefault:
70maxFileSizeKb
Define the maximum file size of the uploaded file kB.
How to use:
maxFileSizeKb: 5000Type:
numbermaxFileUploads
Set the limit of files the user can upload.
How to use:
maxFileUploads: 10Type:
numbermaxImagePixel
Define the maximum pixel width of the uploaded image.
How to use:
maxImagePixel: 5000Type:
numbermaxVideoPixel
Define the maximum pixel width of the uploaded video.
How to use:
maxVideoPixel: 1920Type:
numberDefault:
1920minDurationSec
Define the minimum duration of an audio or video file (other file types ignore this config).
How to use:
minDurationSec: 3Type:
numberminFileSizeKb
Define the minimum file size of the uploaded file in kB.
How to use:
minFileSizeKb: 100Type:
numberminImagePixel
Define the minimum pixel width of the uploaded image.
How to use:
minImagePixel: 10Type:
numberminVideoPixel
Define the minimum pixel width of the uploaded video.
How to use:
minVideoPixel: 100Type:
numberDefault:
100onChanged
Call a pre-defined JS-method to do something when the status of the control changes.
How to use:
onChanged: HFFormdefinition.Namespace.MethodType:
functionSignature:
function(value: IFileUploaderItem[]) => voidrenameFileIfExists
Set "true" for renaming the uploaded file if another one with the same name already exists.
How to use:
renameFileIfExists: trueType:
booleanDefault:
required
Set "true" if the control has to be filled in i.e. at least one file has to be uploaded.
How to use:
required: trueType:
booleanInfo
A FileUploader is used to dynamically add files to a Form.
interface IFileUploaderItem {
name: string;
size: number;
mimeType: string;
width?: number;
height?: number;
}
Stored data
For each uploaded file inside your Forms there are two ways of stored data:
The information contained by the upload control as JSON object...
{
"id": "repair_cover_glass_brokenfileuploader-ctrl",
"value": "[{\"name\":\"standgeraet.png\",\"size\":355283,\"mimeType\":\"image/png\",\"width\":1369,\"height\":1058}]"
}
...and the information of the files attached to the Form item (they are also listed by the feature "documents"):
"files": [
{
"filename": "standgeraet.png",
"size": 355283,
"contentType": "image/png",
"modified": "2021-04-30T07:07:41.3235667Z",
"version": 637553632613235700,
"fileID": 104115
}
]