# Panel Field Type for attachments like documents?

**URL:** <https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009>\
**Category:** Questions\
**Tags:** v2\
**Created:** [July 17, 2017, 8:07pm UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009 "2017-07-17T20:07:03Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![StefanG](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@StefanG](https://forum.getkirby.com/u/StefanG)\
**Post date:** [July 17, 2017, 8:07pm UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/1 "2017-07-17T20:07:03Z")

</div>

Hello,

I am fairly new to Kirby.  
Is there a field type which handles attachments, like PDF?  
I can’t find a proper type. I checked the [Panel Field Types](https://getkirby.com/docs/cheatsheet/#panel-fields) already.

I need to serve 1-3 documents to download (mainly PDF) for the site visitors.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [July 17, 2017, 8:29pm UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/2 "2017-07-17T20:29:39Z")

</div>

There is no particular field, you can either use a select field or have a look at the[Kirby selector](https://github.com/storypioneers/kirby-selector) field. Then you can server these files for download via your template.

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [July 18, 2017, 7:42am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/3 "2017-07-18T07:42:23Z")

</div>

Ive done something similar to this in the past - I would suggest putting a button next to the select that triggers the download, otherwise you end up with lots of wasted downloads because people like to play with selects.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [July 18, 2017, 7:58am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/4 "2017-07-18T07:58:42Z")

</div>

> [@jimbobrjames](#):
>
> I would suggest putting a button next to the select that triggers the download, otherwise you end up with lots of wasted downloads

The select field in the Panel does not trigger a download… I guess you mean in the frontend? But the question was about Panel fields.

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [July 18, 2017, 8:00am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/5 "2017-07-18T08:00:11Z")

</div>

Yes - sounded to me like they want to populate a select on the front end from a field on the backend.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [July 18, 2017, 8:01am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/6 "2017-07-18T08:01:36Z")

</div>

For the frontend, it makes sense not to trigger a download from the select. But then, I wouldn’t use a select on the frontend, anyway. Rather an image of the cover or something more appealing.

---

<div class="post-metadata">

**Author:** ![StefanG](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@StefanG](https://forum.getkirby.com/u/StefanG)\
**Post date:** [July 18, 2017, 8:06am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/7 "2017-07-18T08:06:31Z")

</div>

Hello and good morning,

thank you for your replies.  
What I need is for the backend to upload some files, i.E. pdf. And give those Files a proper screen name.  
On the front end, in the template, I just a simple list with the screen name and the direct link to the files.

Cheers  
Stefan

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [July 18, 2017, 8:07am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/8 "2017-07-18T08:07:20Z")

</div>

Ah, ok, then you don’t need a field at all, you can use the file section in the sidebar to upload files. Just make sure to allow file upload in your blueprint [file settings](https://getkirby.com/docs/panel/blueprints/file-settings).

```auto
files: true

```

Or limit filetype upload:

```auto
…
files:
    type: document

```

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [July 18, 2017, 8:08am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/9 "2017-07-18T08:08:32Z")

</div>

Sure, I would personally do a list on the page. A select is over completing it. My use case for the select was a site menu for mobiles, and picking from the select changed the page rather then triggering download.

@StefanG You can easily do a list on the page with file type icons (via FontAwesome) like this:

```
  <ul class="download--list">

  <?php foreach($page->documents()->filterBy('extension', 'pdf') as $pdf): ?>
      <li><a href="<?= $pdf->url() ?>"><i class="fa fa-file-pdf-o" aria-hidden="true"></i><?= $pdf->filename() ?> (<?= $pdf->niceSize() ?>)</a></li>
  <?php endforeach ?>

  <?php foreach($page->documents()->filterBy('extension', 'doc') as $doc): ?>
      <li><a href="<?= $doc->url() ?>"><i class="fa fa-file-word-o" aria-hidden="true"></i><?= $doc->filename() ?> (<?= $doc->niceSize() ?>)</a></li>
  <?php endforeach ?>

  <?php foreach($page->documents()->filterBy('extension', 'docx') as $docx): ?>
      <li><a href="<?= $docx->url() ?>"><i class="fa fa-file-word-o" aria-hidden="true"></i><?= $docx->filename() ?> (<?= $docx->niceSize() ?>)</a></li>
  <?php endforeach ?>

  <?php foreach($page->archives()->filterBy('extension', 'zip') as $filearchive): ?>
      <li><a href="<?= $filearchive->url() ?>"><i class="fa fa-file-excel-o" aria-hidden="true"></i><?= $filearchive->filename() ?> (<?= $filearchive->niceSize() ?>)</a></li>
  <?php endforeach ?>

  <?php foreach($page->documents()->filterBy('extension', 'xls') as $excel): ?>
      <li><a href="<?= $excel->url() ?>"><i class="fa fa-file-excel-o" aria-hidden="true"></i><?= $excel->filename() ?> (<?= $excel->niceSize() ?>)</a></li>
  <?php endforeach ?>

  <?php foreach($page->documents()->filterBy('extension', 'xlsx') as $excelx): ?>
      <li><a href="<?= $excelx->url() ?>"><i class="fa fa-file-excel-o" aria-hidden="true"></i><?= $excelx->filename() ?> (<?= $excelx->niceSize() ?>)</a></li>
  <?php endforeach ?>

  <?php foreach($page->images()->filterBy('extension', 'jpg') as $jpg): ?>
      <li><a href="<?= $jpg->url() ?>"><i class="fa fa-file-picture-o" aria-hidden="true"></i><?= $jpg->filename() ?> (<?= $jpg->niceSize() ?>)</a></li>
  <?php endforeach ?>

  <?php foreach($page->images()->filterBy('extension', 'eps') as $eps): ?>
      <li><a href="<?= $eps->url() ?>"><i class="fa fa-file-picture-o" aria-hidden="true"></i><?= $eps->filename() ?> (<?= $eps->niceSize() ?>)</a></li>
  <?php endforeach ?>

  <?php foreach($page->images()->filterBy('extension', 'psd') as $psd): ?>
      <li><a href="<?= $psd->url() ?>"><i class="fa fa-file-picture-o" aria-hidden="true"></i><?= $psd->filename() ?> (<?= $psd->niceSize() ?>)</a></li>
  <?php endforeach ?>

  <?php foreach($page->images()->filterBy('extension', 'png') as $png): ?>
      <li><a href="<?= $png->url() ?>"><i class="fa fa-file-picture-o" aria-hidden="true"></i><?= $png->filename() ?> (<?= $png->niceSize() ?>)</a></li>
  <?php endforeach ?>

  </ul>
```

---

<div class="post-metadata">

**Author:** ![StefanG](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@StefanG](https://forum.getkirby.com/u/StefanG)\
**Post date:** [July 18, 2017, 8:11am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/10 "2017-07-18T08:11:05Z")

</div>

yes, but how can I assign an readable user friendly name, like “File Name” and not the\_file.pdf? I think therefore I need a field.  
Kirby offers a nice overview about all attached files. You can edit them, rename the original file, an delete them. But I guess to have another form field to enter a user friendly name, like “The File”, I can call this easily in the templates.

Cheers

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [July 18, 2017, 8:12am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/12 "2017-07-18T08:12:15Z")

</div>

You can do friendly names with file metadata [https://getkirby.com/docs/content/media](https://getkirby.com/docs/content/media)

---

<div class="post-metadata">

**Author:** ![StefanG](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@StefanG](https://forum.getkirby.com/u/StefanG)\
**Post date:** [July 18, 2017, 8:14am UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/14 "2017-07-18T08:14:49Z")

</div>

I don’t like to say awesome, but in this case. Awesome 🙂 Thank you guys for your immediately help.

Cheers  
Stefan

---

<div class="post-metadata">

**Author:** ![StefanG](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@StefanG](https://forum.getkirby.com/u/StefanG)\
**Post date:** [July 20, 2017, 8:10pm UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/15 "2017-07-20T20:10:09Z")

</div>

Just one more thing, a little feedback.

I followed your instructions and created a text file appropriate to the download file (file.pdf), like you guys mentioned. Besides the fact you need to upload the file.pdf.txt manually, it worked quite well.

But, it doesn’t shows up in the file list - since this is a txt file - and is not editable within the panel. Though I stumbled [across this thread](https://forum.getkirby.com/t/adding-metadata-files-for-images-within-the-panel/889) and used the files blueprint instead. Now I can edit the user friendly filename within the panel. And this is quite nice.

 ![](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/d/dcacc12a405624959f3d2438b436c26c3c3ec3bf.png)  
 ![](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/4/443e3fc9f2f139a3c8d2bf892463ca2028c904b3.png)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [July 20, 2017, 8:16pm UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/16 "2017-07-20T20:16:48Z")

</div>

The link above is not really for Panel users, you can find all about using the Panel blueprints and settings. permissions etc. in the [Panel section of the doc](https://getkirby.com/docs/panel)s, file settings are here: [https://getkirby.com/docs/panel/blueprints/file-settings](https://getkirby.com/docs/panel/blueprints/file-settings)

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [September 2, 2017, 4:09pm UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/17 "2017-09-02T16:09:06Z")

</div>

> [@StefanG](#):
>
> Besides the fact you need to upload the file.pdf.txt manually, it worked quite well.

You don’t have to manually create the text file. Upload the file, edit it in the panel and Kirby will create the meta file.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:32pm UTC](https://forum.getkirby.com/t/panel-field-type-for-attachments-like-documents/8009/18 "2025-02-06T17:32:11Z")

</div>


