module Kilt::Upload::Local

Public Class Methods

upload(type, file_reference) click to toggle source
# File lib/kilt/upload/local.rb, line 4
def self.upload type, file_reference
  Kilt::Utils.ensure_local_storage_dir_exists
  if file_reference
    File.open(Rails.root.join('public', 'uploads', type, file_reference.original_filename), 'wb') do |file|
      file.write(file_reference.read)
    end
    file_reference.original_filename
  else
    ''
  end
end