Skip to content

SiFileUploaderComponent documentation

selector
si-file-uploader

Input Properties

NameTypeDefaultDescription
accept
stringDefine which file types are suggested in file browser.
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-accept
acceptText
TranslatableString$localize`:@@SI_FILE_UPLOADER.ACCEPTED_FILE_TYPES:Accepted file types`Text for the accepted file types.
autoUpload
booleanfalseAuto-upload mode - automatically start upload once files are added.
cancelButtonText
TranslatableString$localize`:@@SI_FILE_UPLOADER.CANCEL:Cancel`Text of cancel button. Shown during upload. Required for a11y.
clearButtonText
TranslatableString$localize`:@@SI_FILE_UPLOADER.CLEAR:Clear`Text used inside the clear button.
directoryUpload
booleanfalseEnable directory upload mode. When enabled, the file input will accept directories and upload all files within as a flat list. The hierarchy of the directory will not be preserved. The maxFiles property will have no effect when directoryUpload is enabled.

Note: This feature is not yet available for safari (iOS)
disableUpload
booleanfalseDisable the upload button.
errorTextFileMaxSize
TranslatableString$localize`:@@SI_FILE_UPLOADER.ERROR_FILE_SIZE_EXCEEDED:File exceeds allowed maximum size`Message or translation key if file exceeds the maximum file size limit.
errorTextFileType
TranslatableString$localize`:@@SI_FILE_UPLOADER.ERROR_FILE_TYPE:Incorrect file type selected`Text shown to indicate that an incorrect file type was added to file list.
errorUploadFailed
TranslatableString$localize`:@@SI_FILE_UPLOADER.UPLOAD_FAILED:Upload failed`Text shown if the upload failed.
maxConcurrentUploads
number3Maximum number of concurrent uploads.
maxFiles
number10Define maximal allowed number of files. When directoryUpload is enabled, this will have no effect.
maxFileSize
numberundefinedDefine maximal allowed file size in bytes.
maxFileSizeText
TranslatableString$localize`:@@SI_FILE_UPLOADER.MAX_SIZE:Maximum upload size`Text to describe the maximum file size.
maxFilesReachedText
TranslatableString$localize`:@@SI_FILE_UPLOADER.MAX_FILE_REACHED:Maximum number of files reached`Error message shown when the maximum number of files are reached.
removeButtonText
TranslatableString$localize`:@@SI_FILE_UPLOADER.REMOVE:Remove`Text shown to remove a file from the file list. Required for a11y.
retries
number0Numbers of retries for failed uploads.
showHttpError
booleanfalseOn failed upload, show the error received from the server.
successTextTitle
TranslatableString$localize`:@@SI_FILE_UPLOADER.UPLOAD_COMPLETED:Upload completed`Text shown if the upload was successful.
uploadButtonText
TranslatableString$localize`:@@SI_FILE_UPLOADER.UPLOAD:Upload`Text used inside the upload button.
uploadConfig
FileUploadConfig{ headers: new HttpHeaders({ 'Accept': 'application/json' }), method: 'POST', url: '', fieldName: 'upload_file', responseType: 'json' }Config for HTTP request to upload file.
uploadDropText
TranslatableString$localize`:@@SI_FILE_UPLOADER.DROP:Drop files here or`Text instructing a user to drop the files inside the dropzone.
uploadingText
TranslatableString$localize`:@@SI_FILE_UPLOADER.UPLOADING:Uploading`Text shown during the file upload.
uploadTextFileSelect
TranslatableString$localize`:@@SI_FILE_UPLOADER.FILE_SELECT:click to upload`Text of the link to open the file select dialog (follows uploadDropText ).

Output Properties

NameTypeDescription
filesChanges
UploadFile[]Output which fires whenever new files are added to or removed from the uploader.
uploadCanceled
UploadFileEmits when a user press cancel during upload. The event provides the file details.
uploadCompleted
FileUploadResultOutput callback event will provide you if upload is finished. If an error occurred it will be emitted.

Attributes and Methods

NameTypeDefaultDescription
fileUpload(...)
(doRetry: boolean = true) => voidUploads the file

Parameters
reset(...)
(emit: boolean = true) => voidReset the state.

Parameters

Types Documentation

Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit . Equivalent to a normal string in usage and functionality.
Properties
Additional form fields added in the HTTP request.

Example:
on
{ upload_user: 'Reiner Zufall', expiry_date: ' 21.12.2012' }
additionalFields?: Record<string, string>
Form field name for the uploaded file.
fieldName: string
A function to modify the HTTP request sent on the consumer side.
handler?: (req: HttpRequest<unknown>) => Observable<HttpEvent<unknown>>
headers: (string | HttpHeaders | Record<string, (string | number | (string | number)[])> | Headers)
method: ("POST" | "PUT" | "PATCH")
Specify the server response type
responseType?: ("text" | "json" | "arraybuffer" | "blob")
When true , the file will be sent directly w/o the use of FormData . You will also need to set the Content-Type header when sending binary. See: headers
sendBinary?: boolean
url: string
Copyright (c) Siemens 2016 - 2025 SPDX-License-Identifier: MIT
Properties
errorText?: string
file: File
fileName: string
progress: number
size: string
status: ("error" | "success" | "invalid" | "added" | "queued" | "uploading")
The FileUploadResult is emitted at completion of the file uploading via the uploadCompleted emitter. On success the Http response from the backend is provided and on failure, the error object is available.
Properties
error?: Error
file: string
response?: HttpResponse<unknown>
Translatable
import
Constructor
() => {}
Properties
Define which file types are suggested in file browser.
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-accept

accept: InputSignal<(undefined | string)> = ...
Text or translation key for accepted types.
acceptText: InputSignal<TranslatableString> = $localize`:@@SI_FILE_UPLOADER.ACCEPTED_FILE_TYPES:Accepted file types`
Enable directory upload.
directoryUpload: InputSignalWithTransform<boolean, unknown> = false
dragOver: boolean = false
Message or translation key if file exceeds the maximum file size limit.
errorTextFileMaxSize: InputSignal<TranslatableString> = $localize`:@@SI_FILE_UPLOADER.ERROR_FILE_SIZE_EXCEEDED:File exceeds allowed maximum size`
Text or translation key of message title if incorrect file type is dragged / dropped.
errorTextFileType: InputSignal<TranslatableString> = $localize`:@@SI_FILE_UPLOADER.ERROR_FILE_TYPE:Incorrect file type selected`
fileInput: Signal<ElementRef<any>> = ...
Event emitted when files are added.
filesAdded: OutputEmitterRef<UploadFile[]> = ...
icons: Record<"elementUpload", string> = ...
locale: string = ...
Define maximal allowed file size in bytes.
maxFileSize: InputSignal<(undefined | number)> = ...
maxFileSizeString: Signal<string> = ...
Text or translation key for max file size.
maxFileSizeText: InputSignal<TranslatableString> = $localize`:@@SI_FILE_UPLOADER.MAX_SIZE:Maximum upload size`
Defines whether the file input allows selecting multiple files. When directoryUpload is enabled, this will have no effect.
multiple: InputSignalWithTransform<boolean, unknown> = false
numberFormat: NumberFormat = ...
Text or translation key of the drag&drop field (is combined with the uploadTextFileSelect ).
uploadDropText: InputSignal<TranslatableString> = $localize`:@@SI_FILE_UPLOADER.DROP:Drop files here or`
Text or translation key of the input file selector (is combined with the uploadTextRest ).
uploadTextFileSelect: InputSignal<TranslatableString> = $localize`:@@SI_FILE_UPLOADER.FILE_SELECT:click to upload`
Methods
Parameters
event: DragEvent
Parameters
event: DragEvent
Parameters
num: number
Parameters
files: (null | FileList)
Parameters
items: DataTransferItemList
inputEnterHandler: () => void
Parameters
event: Event
Parameters
file: File
Reset all the files inside the native file input (and therefore the dropzone).
reset: () => void
Parameters
size: number
Parameters
fileType: (undefined | string)
ext: (undefined | string)

Except where otherwise noted, content on this site is licensed under MIT License.