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
}
]