Picks or uploads any file, such as a PDF or a ZIP, from a media library and stores its public path. The field needs a media library; without one it shows an error instead of a picker.

Add this field under fields in .pages.yml:

- name: brochure
  type: file
  options:
    media: documents
    extensions: [pdf]

A saved value in YAML or Markdown front matter might look like:

brochure: /files/brochure.pdf

A saved path must be inside the field's media library, so links to files on other websites are rejected.

Options

Option Description
media The name of the media library to use. Defaults to the first library.
path Folder to open first, as a repository path inside the library's input, such as public/uploads/brochures.
multiple true, or { min, max }, to allow several files, stored as a list.
unique With multiple, true to prevent picking the same file twice.
rename Rename uploads: false, safe (or true) or random. Overrides the library's setting.
categories Allowed file types: image, document, video, audio, compressed, code, font, spreadsheet.
extensions Allowed extensions, such as [pdf, zip]. Overrides categories.

categories and extensions narrow what the library allows; see field settings.