How can I find the size of an uploaded file in Ruby on Rails?

File.size(doc.filename)

Just throw the name of the file into the curly brackets and you should be set.

If you want KB/MB use:

number_to_human_size(File.size(doc.filename))

EDIT:

You can use the exact path or Pathname

1.9.3p125 :005 > x=Pathname.new("/usr/bin/ruby")
 => #<Pathname:/usr/bin/ruby> 
1.9.3p125 :006 > File.size(x)
 => 5488 

For extension:

File.extname("test.rb")         #=> ".rb"

params[:file].size
File.extname(params[:file].original_name)

or params[:file].original_name.match(/\.(\S*)$/).try(:"[]",1)