Module: CarrierWave::Uploader::ContentTypeAllowlist

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

Instance Method Summary collapse

Instance Method Details

#content_type_allowlistObject

Override this method in your uploader to provide an allowlist of files content types which are allowed to be uploaded. Not only strings but Regexp are allowed as well.

Returns

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

an allowlist of content types which are allowed to be uploaded

Examples

def content_type_allowlist
  %w(text/json application/json)
end

Basically the same, but using a Regexp:

def content_type_allowlist
  [/(text|application)\/json/]
end


31
32
# File 'lib/carrierwave/uploader/content_type_allowlist.rb', line 31

def content_type_allowlist
end