FileUploader
The FileUploader ctrl enables the user to upload files inside the form.
<div id="fileuploader-ctrl"
data-win-control="HFWinJSCtrl.FileUploader"
data-win-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.
allowedCharacters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
string
allowedCharactersRegExp
Set the allowed characters for the filenam 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.
allowedCharactersRegExp: [a-zA-Z0-9]
string
allowedFormats
Define the allowed file formats by listing the file extensions.
allowedFormats: ['pdf', 'jpeg', 'jpg', 'png']
string[]
buttonLabel
Provide an individual button label string.
buttonLabel: 'Add file'
string
deleteOnNotFullfilledCondition
De/activate deletion of attachments on not fullfilled conditions.
deleteOnNotFullfilledCondition: false
boolean
true
descriptionEnd
Provide a additional information placed beyond the "file list". (Plain text or restricted HTML text)
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>'
string
descriptionStart
Provide a short intro text. (Plain text or restricted HTML text)
descriptionStart: 'Hier können Sie ihre Unterlagen hochladen.'
string
doNotCopy
Set "true" whenever the field should get deleted if form is copied.
doNotCopy: true
boolean
maxDurationSec
Define the maximum duration of an audio or video file (other file types ignore this config).
maxDurationSec: 120
number
maxFilenameLength
Define the maximum length of a filename.
maxFilenameLength: 100
number
70
maxFileSizeKb
Define the maximum file size of the uploaded file kB.
maxFileSizeKb: 5000
number
maxFileUploads
Set the limit of files the user can upload.
maxFileUploads: 10
number
maxImagePixel
Define the maximum pixel width of the uploaded image.
maxImagePixel: 5000
number
maxVideoPixel
Define the maximum pixel width of the uploaded video.
maxVideoPixel: 1920
number
1920
minDurationSec
Define the minimum duration of an audio or video file (other file types ignore this config).
minDurationSec: 3
number
minFileSizeKb
Define the minimum file size of the uploaded file in kB.
minFileSizeKb: 100
number
minImagePixel
Define the minimum pixel width of the uploaded image.
minImagePixel: 10
number
minVideoPixel
Define the minimum pixel width of the uploaded video.
minVideoPixel: 100
number
100
onChanged
Call a pre-defined JS-method to do something when the status of the control changes
onChanged: HFFormdefinition.Namespace.Method
function
function(value: IFileUploaderItem[]) => void
renameFileIfExists
Set "true" for renaming the uploaded file if another one with the same name already exists.
renameFileIfExists: true
boolean
required
Set "true" if the control has to be filled in i.e. at least one file has to be uploaded.
required: true
boolean
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
}
]