Class: CarrierWave::Uploader::Base

Inherits:
Object
  • Object
show all
Includes:
Cache, Callbacks, Configuration, ContentTypeAllowlist, ContentTypeDenylist, DefaultUrl, Dimension, Download, ExtensionAllowlist, ExtensionDenylist, FileSize, Mountable, Processing, Proxy, Remove, Serialization, Store, Url, Versions
Defined in:
lib/carrierwave/uploader.rb

Overview

An uploader is a class that allows you to easily handle the caching and storage of uploaded files. Please refer to the README for configuration options.

Once you have an uploader you can use it in isolation:

my_uploader = MyUploader.new
my_uploader.cache!(File.open(path_to_file))
my_uploader.retrieve_from_store!('monkey.png')

Alternatively, you can mount it on an ORM or other persistence layer, with CarrierWave::Mount#mount_uploader. There are extensions for activerecord and datamapper these are very simple (they are only a dozen lines of code), so adding your own should be trivial.

Constant Summary

Constants included from CarrierWave::Utilities::Uri

CarrierWave::Utilities::Uri::NON_ASCII, CarrierWave::Utilities::Uri::PATH_SAFE, CarrierWave::Utilities::Uri::PATH_UNSAFE

Instance Attribute Summary collapse

Attributes included from Mountable

#model, #mounted_as

Method Summary

Methods included from Serialization

#as_json, #serializable_hash, #to_json, #to_xml

Methods included from DefaultUrl

#default_url, #url

Methods included from Versions

#cache!, #recreate_versions!, #url, #version_exists?, #version_name, #versions

Methods included from Callbacks

#with_callbacks

Methods included from Processing

#process!

Methods included from Dimension

#height_range, #width_range

Methods included from FileSize

#size_range

Methods included from ContentTypeDenylist

#content_type_denylist

Methods included from ContentTypeAllowlist

#content_type_allowlist

Methods included from ExtensionDenylist

#extension_denylist

Methods included from ExtensionAllowlist

#extension_allowlist

Methods included from Remove

#remove!

Methods included from Download

#download!

Methods included from Cache

#cache!, #cache_name, #cache_path, #cache_stored_file!, #cached?, #retrieve_from_cache!, #sanitized_file

Methods included from Store

#deduplicate, #deduplicated_filename, #filename, #retrieve_from_store!, #store!, #store_path

Methods included from Mountable

#index, #initialize

Methods included from Url

#to_s, #url

Methods included from Proxy

#blank?, #content_type, #current_path, #identifier, #length, #read, #size, #temporary_identifier

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



45
46
47
# File 'lib/carrierwave/uploader.rb', line 45

def file
  @file
end