Sha256: ce967acecc932d7c42d7bb9b28c0cbe9981aaaa5b98ac248b61f7833e06eebb8

Contents?: true

Size: 641 Bytes

Versions: 14

Compression:

Stored size: 641 Bytes

Contents

require 'rubygems'
require 'ramaze'

class Upload < Ramaze::Controller
  def index
    return unless request.post?
    @inspection = h(request.params.pretty_inspect)
    tempfile, filename, @type =
      request[:file].values_at(:tempfile, :filename, :type)
    @extname, @basename = File.extname(filename), File.basename(filename)
    @file_size = tempfile.size

    options = Upload.options
    dir = File.join(options.roots.first, options.publics.first)
    file = File.expand_path(@basename, dir)
    FileUtils.mkdir_p(dir)
    FileUtils.cp(tempfile.path, file)

    @is_image = @type.split('/').first == 'image'
  end
end

Ramaze.start

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ramaze-2023.01.06 examples/app/upload/start.rb
ramaze-2012.12.08 examples/app/upload/start.rb
ramaze-2012.12.08b examples/app/upload/start.rb
ramaze-2012.04.14 examples/app/upload/start.rb
ramaze-2012.03.07 examples/app/upload/start.rb
ramaze-2011.12.28 examples/app/upload/start.rb
ramaze-2011.10.23 examples/app/upload/start.rb
ramaze-2011.07.25 examples/app/upload/start.rb
ramaze-2011.01.30 examples/app/upload/start.rb
ramaze-2011.01 examples/app/upload/start.rb
ramaze-2010.06.18 examples/app/upload/start.rb
ramaze-2010.04.04 examples/app/upload/start.rb
ramaze-2010.04 examples/app/upload/start.rb
ramaze-2010.03 examples/app/upload/start.rb