Sign up (with export icon)

UploadGateway

Api-class icon class

UploadGateway abstracts file uploads to CKEditor Cloud Services.

Properties

Methods

  • Chevron-right icon

    constructor( token, apiAddress )

    Creates UploadGateway instance.

    Parameters

    token : InitializedToken

    Token used for authentication.

    apiAddress : string

    API address.

  • Chevron-right icon

    upload( fileOrData ) → FileUploader

    Creates a FileUploader instance that wraps file upload process. The file is being sent at a time when the send method is called.

    const token = await Token.create( 'https://token-endpoint' );
    new UploadGateway( token, 'https://example.org' )
    	.upload( 'FILE' )
    	.onProgress( ( data ) => console.log( data ) )
    	.send()
    	.then( ( response ) => console.log( response ) );
    
    Copy code

    Parameters

    fileOrData : string | Blob

    A blob object or a data string encoded with Base64.

    Returns

    FileUploader

    Returns FileUploader instance.