Interface ControlFileApi

ControlFileApiBase extension that provides more functionality.

interface ControlFileApi {
    addFile(file: SASUploadedFile): Promise<void>;
    getFileRestrictions(category?: string): FileRestrictions;
    getFiles(category?: string): Promise<SASObjectAttachedFile[]>;
    onChange(handler: ((change: FileChange) => void)): void;
    openFileUploadDialog(options: AttachmentFormData): Promise<SASObjectAttachedFile[]>;
    openImageUploadDialog(allowMultiple: boolean, maxSize?: number): Promise<SASObjectAttachedFile[]>;
    removeFile(id: string): Promise<void>;
    updateFile(updatedFile: SASUploadedFile): Promise<void>;
}

Hierarchy (view full)

Methods

  • Creates a file operation to upload a new file.

    Parameters

    Returns Promise<void>

    A Promise that resolves when the file operation has been created.

  • Returns all saved and unsaved files associated with the current object.

    Parameters

    • Optionalcategory: string

      An optional file category to filter by.

    Returns Promise<SASObjectAttachedFile[]>

    A Promise which resolves to an array of files.

  • Registers a function to be invoked whenever a file change event occurs. This function receives an object that contains information about the change event.

    Parameters

    • handler: ((change: FileChange) => void)

      A function to be invoked when a file change event occurs.

        • (change): void
        • Parameters

          Returns void

    Returns void

  • Opens the image upload dialog box.

    Parameters

    • allowMultiple: boolean

      Determines if multiple files can be uploaded at once.

    • OptionalmaxSize: number

      Maximum size of the image to be uploaded, in bytes.

    Returns Promise<SASObjectAttachedFile[]>

    A Promise which resolves to an array of uploaded files.

  • Creates a file operation to remove a file with a given ID.

    Parameters

    • id: string

      The ID of the file to remove.

    Returns Promise<void>

    A Promise that resolves when the file operation has been created.

  • Creates a file operation to update a given file.

    Parameters

    Returns Promise<void>

    A Promise that resolves when the file operation has been created.