Module: CarrierWave::Uploader::ExtensionWhitelist
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- vendor/carrierwave/lib/carrierwave/uploader/extension_whitelist.rb
Instance Method Summary collapse
-
#extension_whitelist ⇒ Object
Override this method in your uploader to provide a white list of extensions which are allowed to be uploaded.
Instance Method Details
#extension_whitelist ⇒ Object
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 'vendor/carrierwave/lib/carrierwave/uploader/extension_whitelist.rb', line 34 def extension_whitelist; end |