Module: CarrierWave::Uploader::ExtensionAllowlist

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/carrierwave/uploader/extension_allowlist.rb

Instance Method Summary collapse

Instance Method Details

#extension_allowlistObject

Override this method in your uploader to provide an allowlist of extensions which are allowed to be uploaded. Compares the file's extension case insensitive. Furthermore, not only strings but Regexp are allowed as well.

When using a Regexp in the allowlist, `A` and `z` are automatically added to the Regexp expression, also case insensitive.

Returns

NilClass, String, Regexp, Array[String, Regexp]

an allowlist of extensions which are allowed to be uploaded

Examples

def extension_allowlist
  %w(jpg jpeg gif png)
end

Basically the same, but using a Regexp:

def extension_allowlist
  [/jpe?g/, 'gif', 'png']
end

34
35
# File 'lib/carrierwave/uploader/extension_allowlist.rb', line 34

def extension_allowlist
end