Skip to main content
Version: 9.2

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>
PropertyTypeHow to useDescription
allowedFormatsJSON ArrayallowedFormats: ['pdf', 'jpeg', 'jpg', 'png']Define the allowed file formats by listing the file extensions.
buttonLabelStringbuttonLabel: 'Add file'Provide an individual button label string.
deleteOnNot­FullfilledConditionBooleandeleteOnNotFullfilledCondition: falseDe/activate deletion of attachments on not fullfilled conditions. The defaultValue is true.
descriptionStartStringdescriptionStart: 'Hier können Sie ihre Unterlagen hochladen.'Provide a short intro text. (Plain text or restricted HTML text)
descriptionEndStringdescriptionEnd: '<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>'Provide a additional information placed beyond the "file list". (Plain text or restricted HTML text)
doNotCopyBooleandoNotCopy: trueSet "true" whenever the field should get deleted if form is copied.
labelStringlabel: 'File Uploader'Define a label for your control element.
maxFileUploadsNumbermaxFileUploads: 10Set the limit of files the user can upload.
minFileSizeKbNumberminFileSizeKb: 100Define the minimum file size of the uploaded file in kB.
maxFileSizeKbNumbermaxFileSizeKb: 5000Define the maximum file size of the uploaded file kB.
minImagePixelNumberminImagePixel: 10Define the minimum pixel width of the uploaded image.
maxImagePixelNumbermaxImagePixel: 5000Define the maximum pixel width of the uploaded image.
renameFileIfExistsBooleanrenameFileIfExists: trueSet "true" for renaming the uploaded file if another one with the same name already exists.
requiredBooleanrequired: trueSet "true" if the control has to be filled in i.e. at least one file has to be uploaded.
onChangedFunction(value: IFileUploaderItem[])onChanged: HFFormdefinition.Namespace.MethodCall a pre-defined JS-method to do something when the status of the control changes
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
}
]