Skip to content

Allow all file types in Documents except for images/video #836

@busbyk

Description

@busbyk

Allow all file types in Documents except for images and videos. The Media collection is for images and videos.

The DocumentBlock should be updated to have two layout variants:

  1. Embed in an iframe (current behavior)
  2. Show a download link

We might want logic to only allowing embedding in an iframe for some mime types - or we could just trust users to make this decision (and maybe default to the download link layout option).

There isn't an ideal way to implement "all but images are allowed" logic for the Documents collection because the mimeTypes field is an allow list: https://payloadcms.com/docs/upload/overview#mimetypes

We could accomplish that "all but images are allowed" logic using a hook with correct error messaging to users in a toast (Payload's error notification pattern) but we lose the nice UX of only allowing users to select file types in the file upload modal (i.e. the system file picker that pops up from the html file input) that they are actually allowed to upload. That's probably something we can accept though.

We could also see about opening a PR to use a deny list for mime types in Payload.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions