govuk-frontend
    Preparing search index...

    Class FileUpload

    File upload component

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _$root: HTMLElement
    $announcements: HTMLSpanElement
    $button: HTMLButtonElement
    $status: HTMLSpanElement
    enteredAnotherElement: undefined | boolean
    i18n: I18n
    id: string
    defaults: FileUploadConfig = ...

    File upload default config

    elementType: new () => Element = HTMLElement
    moduleName: string = 'govuk-file-upload'

    Name for the component used when initialising using data-module attributes.

    schema: Readonly<{ properties: { i18n: { type: "object" } } }> = ...

    File upload config schema

    Accessors

    Methods

    • Private

      Confirms if the content of a DataTransfer dragged over component can be dropped

      Unfortunately, there's a certain level of uncertainty in Safari which does not even provide a list of items while dragging (and seems to even miss the types sometimes)

      Parameters

      • dataTransfer: DataTransfer

        The DataTransfer being dragged

      Returns boolean

      • true if the DataTransfer looks OK for filling the input, false otherwise
    • Private

      Confirms if enhanced <input> can be filled with files from the given DataTransfer

      Parameters

      • dataTransfer: DataTransfer

        The DataTransfer being dropped

      Returns boolean

      • true if the DataTransfer contains files, in number matching the multiple attribute of the original <input>
    • Private

      Looks up the <label> element associated to the field

      Returns HTMLElement

      The <label> element associated to the field

      If the <label> cannot be found

    • Private

      Confirms the given number of files matches that allowed by the enhanced <input>

      Parameters

      • numberOfFiles: number

        The number of files

      Returns boolean

      • true if the enhanced <input> can accept that number of files
    • Private

      Updates the visibility of the dropzone as users enters the various elements on the page

      Parameters

      • event: DragEvent

        The dragenter event

      Returns void