File field with fields specific to the file

Question regarding setting up a files section in the panel where only specific files can be uploaded, eg. .pdf, .jpg, .png.

Looking to achieve a situation where .jpg and .png have the same set of blueprint fields, while pdf has another set of fields.

Have tried a number of different blueprint setups, but essentially trying to do something like this:

title: Site
sections:
  files:
    type: files
    templates:
      - image
      - pdf

in site/blueprints/files I have to file templates: image.yml and pdf.yml where image mime types are limited with:

title: Image
accept:
  mime: image/jpeg, image/png
fields:
  ...

When opening an uploaded file in the panel it simply displays a underneath “template”, indicating that it hasn’t assigned a template to the file.

Have scoured over the docs and forum, but can’t seem to find a simple way to do this. Any tips would be much appreciated :wink:

The option is called template, and you can only pass a string, i.e. a single template, not an array of options. I’d set up two different files sections for this because when uploading, you can’t select a template. I works different then when creating a page; there the modal allows you to select a template.

Two file sections it is then, thanks so much! :wink: