File 

The File type generates a field for file relations.

Settings 

extendedPalette

extendedPalette
Type
boolean
Default
true

If enabled, an additional image or media palette will be rendered. For image files it consists of the additional fields crop, alternative and link. For audio and media files an additional autoplay field is added. For other file types, like plain text, this option has no effect. Disable this option, if you don't need these additional fields.

allowed

allowed
Type
string|array
Default
''

Possible values: common-image-types, common-media-types or your custom list of file types.

maxitems

maxitems
Type
integer
Default
99999

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer

Minimum number of items. Default is no minimum. JavaScript record validation prevents the record from being saved if the limit is not satisfied. The field can be set as required by setting minitems to at least 1.

relationship

relationship
Type
string
Default
oneToMany

The relationship defines the cardinality between the relations. Possible values are oneToMany (default), or oneToOne. In case of a oneToOne relation, the processed field will be filled directly with the file reference instead of a collection of file references. In addition, maxitems will be automatically set to 1.

cropVariants

cropVariants
Type
array
Default
[]

It is possible to define crop variants for this specific field and Content Block. This documentation only covers the most basic configuration. Refer to the TCA documentation for a complete overview of possibilities.

Example configuration below. The aspect ratios can be defined as a float value or a fraction. Only the simple division operation a / b is allowed.

cropVariants:
  default:
    title: Teaser
    allowedAspectRatios:
      portrait:
        title: Portrait
        value: 0.75
      landscape:
        title: Landscape
        value: 4 / 3
    coverAreas:
      - x: 0.25
        y: 0.3
        width: 0.5
        height: 0.4
Copied!

overrideType

overrideType
Type
array
Default
[]

Type Overrides can be used to override the File Definition in the context of as single field. Refer to the API documentation if you want to learn more.

overrideType:
  image:
    - identifier: image_overlay_palette
      type: Palette
      label: 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette'
      fields:
        - identifier: alternative
          useExistingField: true
        - identifier: description
          useExistingField: true
        - type: Linebreak
        - identifier: link
          useExistingField: true
        - identifier: title
          useExistingField: true
        - type: Linebreak
        - identifier: example_custom_field
          type: Text
          label: 'My custom Field'
        - type: Linebreak
        - identifier: crop
          useExistingField: true
Copied!

appearance.collapseAll

appearance.collapseAll
Type
boolean

When true, all file records are shown collapsed. When false, all are expanded.

appearance.expandSingle

appearance.expandSingle
Type
boolean

When enabled, only one file record is expanded at a time.

appearance.createNewRelationLinkTitle

appearance.createNewRelationLinkTitle
Type
string

Overrides the "Create new relation" button label with a localized string.

appearance.addMediaLinkTitle

appearance.addMediaLinkTitle
Type
string

Overrides the "Add media by URL" button label with a localized string.

appearance.uploadFilesLinkTitle

appearance.uploadFilesLinkTitle
Type
string

Overrides the "Select & upload files" button label with a localized string.

appearance.useSortable

appearance.useSortable
Type
boolean
Default
true

Activates drag & drop sorting of file records.

appearance.showPossibleLocalizationRecords

appearance.showPossibleLocalizationRecords
Type
boolean

Show unlocalized file records that exist in the original language but have not yet been translated.

appearance.enabledControls

appearance.enabledControls
Type
object

Enables or disables individual controls on file records. Available keys with their defaults:

edit (bool, default true)
Show or hide the edit control.
info (bool, default true)
Show or hide the info control.
dragdrop (bool, default true)
Show or hide the drag & drop handle.
sort (bool, default false)
Show or hide the sort arrows.
hide (bool, default true)
Show or hide the hide/show toggle.
delete (bool, default true)
Show or hide the delete control.
localize (bool, default true)
Show or hide the localize control.

Example:

appearance:
  enabledControls:
    sort: true
    delete: false
Copied!

appearance.headerThumbnail

appearance.headerThumbnail
Type
object

Defines the dimensions of the preview thumbnail shown in the inline header. Accepts width and height as string or integer values.

Example:

appearance:
  headerThumbnail:
    width: 64
    height: 64
Copied!

appearance.fileUploadAllowed

appearance.fileUploadAllowed
Type
boolean
Default
true

Show or hide the "Select & upload file" button.

appearance.fileByUrlAllowed

appearance.fileByUrlAllowed
Type
boolean

Show or hide the "Add media by URL" button, used to embed media from services such as YouTube or Vimeo.

appearance.elementBrowserEnabled

appearance.elementBrowserEnabled
Type
boolean

Show or hide the element browser button.

behaviour.allowLanguageSynchronization

behaviour.allowLanguageSynchronization
Type
boolean
Default
false

Allows to select if localization uses custom or default language value.

behaviour.disableMovingChildrenWithParent

behaviour.disableMovingChildrenWithParent
Type
boolean
Default
false

Disables automatic moving of file references when the parent record is moved.

behaviour.enableCascadingDelete

behaviour.enableCascadingDelete
Type
boolean
Default
true

When disabled, attached file references are not deleted when the parent record is deleted.

disallowed

disallowed
Type
string|array

File extensions to disallow even if they are listed in allowed. Accepts the same values as allowed.

fieldInformation

fieldInformation
Type
object

fieldWizard

fieldWizard
Type
object

overrideChildTca

overrideChildTca
Type
object

Overrides TCA configuration of the sys_file_reference records attached to this field.

readOnly

readOnly
Type
boolean
Default
false

Renders the field in a way that the user can see the value but cannot edit it.

Example 

Minimal 

All file types allowed, no restrictions.

name: example/file
fields:
  - identifier: my_file_field
    type: File
Copied!

Advanced / use case 

Allow only image types, disable extended palette (no cropping field), require at least one image and set limit to 10 images.

name: example/image
fields:
  - identifier: image
    type: File
    extendedPalette: false
    minitems: 1
    maxitems: 10
    allowed: common-image-types
Copied!

Allow media types like audio, video and youtube (or vimeo).

name: example/media
fields:
  - identifier: media
    type: File
    allowed: common-media-types
Copied!

Set specific crop variants for an image field.

name: example/image
fields:
  - identifier: image
    type: File
    allowed: common-image-types
    cropVariants:
      desktop:
        title: Desktop
        allowedAspectRatios:
          portrait:
            title: Portrait
            value: 0.75
          landscape:
            title: Landscape
            value: 4 / 3
        focusArea:
          x: 0.3
          y: 0.3
          width: 0.4
          height: 0.4
        coverAreas:
          - x: 0.1
            y: 0.8
            width: 0.8
            height: 0.1
      tablet:
        title: Tablet
        allowedAspectRatios:
          square:
            title: Square
            value: 0.75
      smartphone:
        title: Smartphone
        allowedAspectRatios:
          landscape:
            title: Landscape
            value: 4 / 3
Copied!

Usage in Fluid 

<f:for each="{data.image}" as="image">
    <f:image image="{image}" width="120" maxHeight="100"/>
</f:for>
Copied!