Module: CarrierWave::Uploader::ExtensionWhitelist

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

Instance Method Summary collapse

Instance Method Details

#extension_whitelistObject

Override this method in your uploader to provide a white list 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 white list, ‘A` and `z` are automatically added to the Regexp expression, also case insensitive.

Returns

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

a white list of extensions which are allowed to be uploaded

Examples

def extension_whitelist
  %w(jpg jpeg gif png)
end

Basically the same, but using a Regexp:

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


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

def extension_whitelist; end