Class

FileUploader (cloud-services/uploadgateway)

@ckeditor/ckeditor5-cloud-services/src/uploadgateway/fileuploader

class

FileUploader class used to upload single file.

Filtering

Properties

  • file : Blob

    A file that is being uploaded.

  • _apiAddress : String

    private

    CKEditor Cloud Services API address.

  • _token : Token

    private

    CKEditor Cloud Services access token.

Methods

  • constructor( fileOrData, token, apiAddress )

    Creates FileUploader instance.

    Parameters

    fileOrData : Blob | String

    A blob object or a data string encoded with Base64.

    token : Token

    Token used for authentication.

    apiAddress : String

    API address.

  • abort()

    Aborts upload process.

  • onError( callback ) → FileUploader

    Registers callback on error event. Event is called once when error occurs.

    Parameters

    callback : function

    Returns

    FileUploader
  • onProgress( callback ) → FileUploader

    Registers callback on progress event.

    Parameters

    callback : function

    Returns

    FileUploader
  • send() → Promise.<Object>

    Sends XHR request to API.

    Returns

    Promise.<Object>
  • _attachXHRListeners()

    private

    Attaches listeners to the XHR.

  • _prepareRequest()

    private

    Prepares XHR request.

  • _sendRequest()

    private

    Sends XHR request.

Events

  • error( eventInfo, error )

    Fired when error occurs.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.

    error : String

    Error message

  • progress( eventInfo, status )

    Fired on upload progress.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.

    status : Object

    Total and uploaded status