Function showUploadFile

  • Displays a file upload dialog and returns an array of SdkFile objects containing the selected files' data and metadata.

    Parameters

    • ctx: Context

      The context object that provides access to the render method.

    • options: ShowUploadFileOptions

      The options to configure the file upload dialog.

    Returns Promise<SdkFile[] | null>

    A promise that resolves with an array of SdkFile objects, or null if the user cancels the dialog.

    Example

    const options = {
    fileUploadTitle: 'Upload Files',
    uploadButton: 'Upload',
    text: 'Please select file to upload.',
    fileLimit: 3,
    error: 'You can upload up to 3 files only.',
    validate: async (file) => {
    if (file.size > 1024 * 1024) {
    return { isValid: false, message: 'File size exceeds 1MB.' };
    }
    return { isValid: true, message: '' };
    },
    };
    const selectedFiles = await showUploadFile(context, options);
    if (selectedFiles) {
    // Process the selected files.
    }

Generated using TypeDoc