$files->findBy() with Blueprint

I’m new to Kirby and I want to use different file inputs on Different positions on my page. Currently, I found the Solution $files->findBy() and the template. Is there a better option, like blueprint fields?
Thanks for your help.

Hey, welcome to the forum and Kirby.

Not quite sure what you are after, do you mean fields where users can select files in the Panel?

Thanks, for your prompt answer. I want to create, for example, three inputs with blueprints(thats not the problem). For example one JPG as Header, one right before the footer and one button with a PDF. Is there something like this to show only the file in this special blueprint at the Frontent: $page->files()->findBy(‘blueprint’, ‘header_img’)

If the files are selected in a files field, you can retrieve them in the frontend like described here: Files | Kirby CMS

If you upload them via a files section and assign a particular files blueprint/template to each of the sections, you can then fetch the files by this template, for example:

<?php if ($image = $page->files()->template('cover')->first()): ?>
<img src="<?= $image->url() ?>">
<?php endif ?>

Okay. Thanks for your prompt help.

Thanks. The second one worked very well. But the other wound work. What did I wrong?

    <?php if($image = $page->cm_header()->toFile()): ?>
        <img class="head" src="<?= $image->url() ?>" alt="">
    <?php endif ?>
        width: 1/2
            type: files
            label: Showbild
            layout: cards
            info: "{{ file.dimensions }}"
            template: head-img
            multible: false

This is a files section, you cannot treat it as a field, therefore you have to use the example from above:

<?php if ($image = $page->files()->template('head-img')->first()): ?>
<img src="<?= $image->url() ?>">
<?php endif ?>

Okay, thanks. Now i know what you mean.