How to allow upload of specific compressed file extensions

Created on 4 May 2023, over 1 year ago
Updated 21 December 2023, 11 months ago

Problem/Motivation

I would like the users to upload compressed (.tar.gz) configuration (.yml) files.

Is it possible to write this pseudo-condition in the "Allowed file extensions" of a file reference field?
.yml.tar.gz
that is, to allow upload of .tar.gz files that uncompress/result to only .yml files?

Thank you 🙏🏻

💬 Support request
Status

Active

Version

11.0 🔥

Component
File system 

Last updated about 3 hours ago

Created by

🇮🇹Italy kopeboy Milan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @kopeboy
  • 🇮🇳India rksyravi New Delhi, 🇮🇳

    Hey @kopeboy

    Drupal core provides the functionality to add and restrict the file upload to certain extensions.
    In your case, you wanted the file upload only to support .yml.tar.gz. For this, you can simply add the said extension to Allowed file extensions of File upload.
    Add extension:

    And for uncompress, the resultant will be the same how the file is compressed. For example, 1 file (test.yml.tar.gz) uncompressed result will be test.yml

Production build 0.71.5 2024