Simple and Easy Image Upload

Hi all,

I've done a good 8+ hours of searching for a good solution to my problem
but have had little success finding a nice and easy image upload
solution. Oh, and I am new to rails.

My problem/requirement is that I want to upload an image to the file
system (not the database) as quickly and efficiently as possible. I
currently do not want any resizing or ajax functionality (so no
fleximage/swfupload), just a plain <%= f.file_field :image %> to allow
me access to select the image and upload it to the /public/images/users

There must be a very easy way to do this in rails. I have noticed that
there are a lot of people uploading directly into the database. Is this
a better way? It seems to me that the database should be strictly for

Thanks in advance and I apologize for the novice questions!

Best regards,


I do this on the filesystem with:

(params[:photo] is posted)

file_name = "something""#{RAILS_ROOT}/public/writable/submissions/" <<
@user.path << "/tmp/" << file_name, "w"){ |f|

  # and for resize..

    image ="#{RAILS_ROOT}/public/writable/submissions/"
<< @user.path << "/tmp/" << file_name).first

     if !image.nil?

       @type = image.format
       @geometry = image.columns.to_s + "x" + image.rows.to_s
       @imgcol = image.image_type

       long_side = (image.columns > image.rows) ? image.columns : image.rows

       im = image.change_geometry!(tn) { |cols, rows, img|
       img.resize!(cols, rows) }
       im.write("#{RAILS_ROOT}/public/writable/submissions/" <<
@user.path << "/thumb/" << file_name)

Did you check out paperclip,,
or attachment_fu,

You don't need to use the resizing features and both allow saving to
the file system.

You also don't want to upload directly to the database. Use the db
just to store meta-data about the image.