module Paperclip::Storage::Filesystem

The default place to store attachments is in the filesystem. Files on the local filesystem can be very easily served by Apache without requiring a hit to your app. They also can be processed more easily after they've been saved, as they're just normal files. There are two Filesystem-specific options for has_attached_file:

Public Class Methods

extended(base) click to toggle source
# File lib/paperclip/storage/filesystem.rb, line 25
def self.extended base
end

Public Instance Methods

copy_to_local_file(style, local_dest_path) click to toggle source
# File lib/paperclip/storage/filesystem.rb, line 84
def copy_to_local_file(style, local_dest_path)
  FileUtils.cp(path(style), local_dest_path)
end
exists?(style_name = default_style) click to toggle source
# File lib/paperclip/storage/filesystem.rb, line 28
def exists?(style_name = default_style)
  if original_filename
    File.exist?(path(style_name))
  else
    false
  end
end

Private Instance Methods

move_file(src, dest) click to toggle source
# File lib/paperclip/storage/filesystem.rb, line 90
def move_file(src, dest)
  # Support hardlinked files
  if File.identical?(src, dest)
    File.unlink(src)
  else
    FileUtils.mv(src, dest)
  end
end