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: 'Hier kΓΆnnen Sie ihre Unterlagen hochladen.',
descriptionEnd: '<div class=\'custom-class\'><small>Only PDF, JPEG and PNG Dateien 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: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
Type:
string
allowedCharactersRegExpβ
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:
string
allowedFormatsβ
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:
string
deleteOnNotFullfilledConditionβ
De/activate deletion of attachments on not fullfilled conditions.
How to use:
deleteOnNotFullfilledCondition: false
Type:
boolean
Default:
true
descriptionEndβ
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:
string
descriptionStartβ
Provide a short intro text. (Plain text or restricted HTML text)
How to use:
descriptionStart: 'Hier kΓΆnnen Sie ihre Unterlagen hochladen.'
Type:
string
doNotCopyβ
Set "true" whenever the field should get deleted if the Form is copied.
How to use:
doNotCopy: true
Type:
boolean
maxDurationSecβ
Define the maximum duration of an audio or video file (other file types ignore this config).
How to use:
maxDurationSec: 120
Type:
number
maxFilenameLengthβ
Define the maximum length of a filename.
How to use:
maxFilenameLength: 100
Type:
number
Default:
70
maxFileSizeKbβ
Define the maximum file size of the uploaded file kB.
How to use:
maxFileSizeKb: 5000
Type:
number
maxFileUploadsβ
Set the limit of files the user can upload.
How to use:
maxFileUploads: 10
Type:
number
maxImagePixelβ
Define the maximum pixel width of the uploaded image.
How to use:
maxImagePixel: 5000
Type:
number
maxVideoPixelβ
Define the maximum pixel width of the uploaded video.
How to use:
maxVideoPixel: 1920
Type:
number
Default:
1920
minDurationSecβ
Define the minimum duration of an audio or video file (other file types ignore this config).
How to use:
minDurationSec: 3
Type:
number
minFileSizeKbβ
Define the minimum file size of the uploaded file in kB.
How to use:
minFileSizeKb: 100
Type:
number
minImagePixelβ
Define the minimum pixel width of the uploaded image.
How to use:
minImagePixel: 10
Type:
number
minVideoPixelβ
Define the minimum pixel width of the uploaded video.
How to use:
minVideoPixel: 100
Type:
number
Default:
100
onChangedβ
Call a pre-defined JS-method to do something when the status of the control changes.
How to use:
onChanged: HFFormdefinition.Namespace.Method
Type:
function
Signature:
function(value: IFileUploaderItem[]) => void
renameFileIfExistsβ
Set "true" for renaming the uploaded file if another one with the same name already exists.
How to use:
renameFileIfExists: true
Type:
boolean
Default:
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: true
Type:
boolean
Info
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
}
]