Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Custom blueprint `type: pagemedia` allowed filetypes

Started by Sebastian 8 years ago · 1 replies · 829 views
8 years ago

Hey guys,

I'm using custom blueprints for my pages in grav admin and noticed that if using type: pagemedia for organizing media files, there is now way to set which files are allowed for uploading, like it works with type: file

YAML
type: file
accept:
  - 'image/*'

Have my blueprint as example.

YAML
title: Media

form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        gallery:
          type: tab
          title: Media Verwaltung

          fields:
            fileupload:
              type: file
              label: Bild hochladen
              destination: 'page@:/media'
              multiple: true
              limit: 10
              avoid_overwriting: true
              filesize: 5
              accept:
                - 'image/*'
                - 'video/*'
                - '.pdf'
            mediaOrganizr:
              label: Datein verwalten, hochladen, löschen
              type: pagemedia
              ## NOT WORKING ##
              accept:
                - 'image/*'
                - 'video/*'
                - '.pdf'

So is there a way of limiting the upload or the allowed filetypes at all?

Also I found out that in pagemedia.html.twig on line 25
{% set uploadLimit = grav.config.system.media.upload_limit / 1024 / 1024 %} .media.upload_limit is never set on default in the system.yaml?

Could need some help here 🙂

Cheers

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1135 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 61 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 134 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 108 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 128 7 months ago