How to allow upload of specific compressed file extensions

Created on 4 May 2023, about 2 years 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

10.1

Component
File system 

Last updated 1 day ago

Created by

🇮🇹Italy kopeboy Milan

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

Comments & Activities

  • 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

  • Status changed to Closed: works as designed 3 months ago
  • 🇳🇿New Zealand quietone

    @rksyravi, thanks for responding.

    Closing

Production build 0.71.5 2024