Skip to main content

File

The file field allows users to specify files to be included as email attachments. These attachments are validated to ensure they meet size, type, and MIME requirements before being sent.

Example

fields:
  attachment:
    type: file
    label: Attach a File
    maxsize: 10485760
    extension:
      - pdf
      - jpeg
      - png

Field Properties

Name Type Default Description
aria string

Optional aria label for better accessibility.

autofocus bool false

Set autofocus on field.

error string | array

Costum error message for translation or customization.

extension array

Limits the file types that can be attached using file extensions.
Supported file types: jpg, jpeg, png, gif, webp, svg, pdf, doc, docx, txt, csv, json, xls, xlsx, ppt, pptx, zip, rar, 7z

help string | array

Optional help text below the field

label string | array

The field label can be set as string or associative array with translations

max int

Maximum number of files

maxsize int 5242880 (5 MB)

Defines the maximum allowed size for a single file in bytes.

placeholder string | array

Optional placeholder value that will be shown when the field is empty.

required bool

Defines whether the field is mandatory for form submission.

title string | array

Tooltip displayed when the user hovers over the field (supports multilingual configurations).

width string 1/1

The width of the field in the 12 columns field grid.

Validation Logic

The file field automatically enforces the following validation rules:

  • File Size maxsize: Ensures the file size does not exceed the configured limit.
  • File Type extension: Verifies that the file extension matches one of the allowed types.
  • MIME Type Validation: Checks the actual file content against the expected MIME type for security.
  • File Signature Validation: Validates the file's magic numbers to ensure it's not a disguised malicious file.
  • Security Checks: Blocks potentially dangerous file types (PHP, EXE) and hidden files.