Issue Feature Resolved

#103594Allow specific file extensions per File Storage

Marcelo Vetter 04/10/24, 21:42 updated 10/29/26, 17:30

Description

Let’s image we have two File Storages set up:
  • Documents (/fileadmin/documents/*)
  • Images (/fileadmin/images/*)
I would like to only allow specific file types per File Storage:
  • Documents (.pdf, .doc, .docx, .etc…)
  • Images (.jpg, .jpeg, .png, .gif, .webp, .etc…)

I’ve created a simple BeforeFileAddedEvent listener (which I’m attaching here as an example). Below is a sample PageTS Config on the Page ID 1 Resources tab or on the user or user group Options tab:

permissions.file.storage {

  // 1 = Images Storage ID
  1 {
    allowedExtensions = jpg|jpeg|png|webp|gif|svg
    allowedExtensionsMsg = To upload a document, please use the Documents drive.
  }

  // 5 = Documents Storage ID
  5 {
    allowedExtensions = pdf|docx|doc|csv|xlsx|xls|pptx|ppt
    allowedExtensionsMsg = To upload an image, please use the Images drive.
  }

}

Is it doable to include something similar in the core of TYPO3?

Thanks!

Reviews 1

Files 1

History 517

  1. Mathias Bolt Lesniak commented <span data-processor="relativetime" data-value="2024-04-11T06:09:52+00:00" > 04/11/24, 06:09 </span>

    Hi Marcelo!

    Thank you for posting this, and for including a proof of concept PHP file!

    I wonder about the use case for this and the reason for placing the configuration within PageTS or UserTS. Couldn’t this configuration also be placed within the File Storage record? Or is it a specific requirement that the allowed files can be changed depending on the user or page?

    — Mathias

  2. Marcelo Vetter commented <span data-processor="relativetime" data-value="2024-04-12T04:15:47+00:00" > 04/12/24, 04:15 </span>

    Hi Mathias,

    That’s just a proof of concept as you mentioned.

    I didn’t search a way to add it directly to the File Storage record or even via TypoScript. If the configuration is done directly in the File Storage settings, that would be fine with me, and it makes a lot more sense!

    However, having the flexibility to configure it per user or user groups would be for convenience in the future. In my situation, I might allow some users to upload videos as well in the Image/Media storage. All other users could only upload images.

    Cheers!
    - Marcelo

  3. Oliver Bartsch commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-29T17:30:18+00:00" > 10/29/26, 17:30 </span>

    Applied in changeset commit:20514713728f9de708889d998cec1c0725f9d8d6.