Displays a composite field to upload files.

type

(string)  Must be equals to file.

label

(string)  The label to display next to the field.

help

(string)  An optional text to describe the purpose of the field.

required

(bool)  Whether the field is mandatory or optional.

value

(string|array)  The last uploaded file(s).

id

(string)  An optional field ID.

class

(string)  An optional field class suffix.

hidden

(bool)  True to avoid displaying the label of the field.

multiple

(bool)  Whether the field supports the upload of multiple files (false by default).

files

(array[])  An array containing the details of the uploaded files.

  • name - the file name;
  • uri - the complete file URL.
[
    'gallery' => [
        'type' => 'file',
        'label' => 'Gallery',
        'value' => ['image-1.png', 'image-2.png'],
        'multiple' => true,
        'files' => [
            [
                'name' => 'image-1.png',
                'uri' => JUri::root() . 'images/image-1.png',
            ],
            [
                'name' => 'image-2.png',
                'uri' => JUri::root() . 'images/image-2.png',
            ],
        ],
    ]
]

Changelog

Version Description
1.7.3 Introduced.
Last Update: 2022-03-09 14:37
Helpful?