Best way to upload an image and make a thumbnail

I'd do a system call to image magic's convert program to make the
thumbnail... about the best performance your going to get

def thumbnail(temp, target)
  system(
    "/usr/local/bin/convert #{escape(temp)} -resize 48x48!
#{escape(target)}"
  )
end

DHH touches on this in "Outsourcing the performance-intensive
functions" on this blog page:
http://www.loudthinking.com/arc/2006_09.html

Not really following you on what your asking about with the how to
upload part of the question? and not sure what javascript has to do
with it? It should just be a file-upload field as far as the browser
goes. For saving on the server I do something like this in one of my
models:

  def save_file(file_name, file)
    fh = File.open(file_name, 'w')
    fh.write(file.read)
    fh.close
  end

  def image=(img)
    return if img.blank?
    save_file("/whatever/name/for_my_file.jpg", img)
  end

good luck!
Tim