Feature #103594
openAllow specific file extensions per File Storage
0%
Description
- Documents (/fileadmin/documents/*)
- Images (/fileadmin/images/*)
- 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!
Files
Updated by Mathias Bolt Lesniak 8 months ago
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
Updated by Marcelo Vetter 8 months ago
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