files/src/file_upload.ts
This service is supposed to be declared as provider for a container with content style 'fileupload' and then injected into its constructor as a Self dependency.
Methods |
Accessors |
constructor(container: Container, session: BlueriqSession, uploadService: UploadService, eventHandler: SessionEventHandler, errorHandler: FunctionalErrorHandler, dispatcher: Dispatcher)
|
|||||||||||||||||||||
Parameters :
|
getUploadDetails |
getUploadDetails()
|
Returns an UploadDetails object which contains the URL to use for uploading with this container, additional headers to apply to the request and possibly multipart contents.
Returns :
UploadDetails
|
handleFileUploadCompleted | ||||||||
handleFileUploadCompleted(response: UploadResponse)
|
||||||||
When the files are uploaded, the runtime responds with events describing the page changes. Because the upload is triggered by the upload component, which does not understand these events, this function needs to be called to handle them appropriately. This method should even be called for fault-responses. They may be recognized as functional errors and handled as such, or an exception is thrown to indicate that something went wrong.
Parameters :
Returns :
void
|
toHumanReadableSize | |||||||||||||||
toHumanReadableSize(sizeInBytes: number, precision: number)
|
|||||||||||||||
Formats a size in bytes to a human readable text string. e.g.
Parameters :
Returns :
string
a textual representation of the size |
allowedExtensions |
getallowedExtensions()
|
Array containing the file extensions (without dot) that can be uploaded. If not defined, all file extensions are allowed.
Returns :
[] | undefined
|
multiple |
getmultiple()
|
Returns whether this file upload container accepts multiple files.
Returns :
boolean
|
uploadLabel |
getuploadLabel()
|
Returns the text label (in the specified language), taking into account if this container can upload multiple files or not.
Returns :
string
|
maxFileSizeDescription |
getmaxFileSizeDescription()
|
Returns a text message to display regarding the max file size of a file to upload. If there is no maximum file size specified, an empty string is returned.
Returns :
string
|
allowedExtensionsDescription |
getallowedExtensionsDescription()
|
Returns a text message to display regarding the allowed extensions of a file to upload. If there are no restrictions, an empty string is returned.
Returns :
string
|
uploadSucceededMessage |
getuploadSucceededMessage()
|
Text message to display when an upload succeeded.
Returns :
string
|
uploadFailedMessage |
getuploadFailedMessage()
|
Text message to display when an upload failed.
Returns :
string
|
extensionInvalidValidationMessage |
getextensionInvalidValidationMessage()
|
Text message to display when an upload failed because of a file extension that is not allowed.
Returns :
string
|
fileTooLargeValidationMessage |
getfileTooLargeValidationMessage()
|
Text message to display when an upload failed because of the size of the file that is too large.
Returns :
string
|