• Subscribe  

Three Ruby on Rails File Upload Plugins reviewed

Posted by Charles | March 21, 2007 .

Hardly any web application this day won’t need file upload, mainly for all the media types, photos and videos. When using framework like Ruby on Rails, there are all kinds of plugins you can pick to speed up your development. For example, file upload, there are three major ones available. Which one you should go for? It’s actually a question harder than you thought.

These three file upload plugins are Acts As Attachment, File Column Plugin and FlexImage. The last one has nothing to do Flex, just you know. Before I start the review and comparison, I’d like say Ruby on Rails is great but documents from Ruby on Rails developers suck!

They all use RMagick to resize uploaded image and create multiple versions in different sizes.

Acts As Attachment

Written by Rick Olson, member of Ruby on Rails Core Team. It’s a very complete RoR plugin, in terms of testing and well structured code.

What I like:

  • The generator comes with it can generate model with metadata such as file size, content type, height and width, etc. The data will be populated at creation time automatically. The data structure also trace the relationship between main image and the thumbnail image via self reference attribute parent_id, a defaulting attribute name for RoR to allow out of box Acts As Tree behavior.
  • It allows you store file in file system or database blob, with reasonable default filesystem directory structure, to RAILS_ROOT/public/my_models/5/blah.jpg.

What I don’t like:

  • Have to read the source code to figure out how the file get stored. There is no way to configure the file storage place to be flexible. Some model method such public_filename has to be overwritten to make flexible location available.
  • File attachment validation is flicky.

File Column Plugin

The oldest and most used file upload plugin.

What I like:

  • There are ways to set custom file storage location. Good. You can do callback function at :store_dir option to make it fits exactly how you want the file get stored. The reason I’m asking for file storage flexibility is that once you know how to get file uploaded, uploading is trivial, however, managing files are big deal when you do expect large amount of files.
  • It provides view helper to generate image url for viewing.
  • Many RoR developers use it and provide feedback. Easier to find hacks or modifications.


This is relatively newer file upload plugin for RoR. It has build-in features to provide special effects on the image you present, via RMagick. It’s cool when you first see it and use it.

What I like:

  • The build-in special image overlays. It’ll help you branding your data.
  • It’s super easy to store image into BLOB column and retrieve it. Along with page caching, it could be great file management solution, if you like store file in DB.

What I don’t like:

  • Once file gets store, there is no metadata information. By default, your file name becomes the id.jpg. The original file name is not preserved unless you code something around this plugin, not very DRY.
  • No flexible way of store file into filesystem under custom directories. All files, if use file system, will be stored in one place. It’s practically unrealistic for site deal with lots of uploads.
    We’ve been using FlexImage. Now I think we’ll switch back to File Column Plugin. As I mentioned earlier, uploading file is not a big deal once you get it works. You like to have the flexibility to efficiently manage the files on your server. Especially when you are expecting large amount of files coming in, when a more robust distributed file storage is under consideration, you really want to put the files to the right place earlier on. Another big challenge imposed to the site design is that file system or DB BLOB? I like file system but I’m sure there is good cases that DB BLOB works better.

 Three Ruby on Rails File Upload Plugins reviewed

Leave a Comment

If you would like to make a comment, please fill out the form below.




To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word


To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Related Posts

20 Comments so far
  1. xain  April 12, 2007 8:29 am

    ok, I’m going to use file column, because I need to know the uploaded images’ urls.

  2. Nano  April 17, 2007 3:35 pm

    You’re missing one: attachment_fu. That’s actually the same acts_as_attachment but v2.0, by the same author.

    attachment_fu is far the more sophisticated one. But that’s good and bad.
    Good: MANY features.
    bad: Hard to shape the code to your needs.

    However, i choosed FlexImage. Simpler (no specific columns on db required, besides blob if you’ll use db storage, interface generic, simple and adaptable ).
    About all files in one place, the other plugins aren’t better: for each image: 1 folder, 1 base image, thumbnails image, each in one folder. Plus, in database 1 row for image + 1 row for each thumbnail.
    So, that’s worse to me.

    The other thing, i don’t want to store each thumbnail, just the originals. FlexImage makes all of them on-the-fly. Think of millions of images with millions of thumbnails, and you decide to change the thumbnail size. You’ll want to die…

    The other reason, is that i need to store 300Gb of images. So thumbnail space + number of files/folders it’s not low.

    About the file information, well you can work it around by using a column on the database and using in the controller with params[‘data’].original_filename and params[‘data’].content_type if you want to.

    Besides that, the shadow plus other effects ROCK!!! 😀

  3. bitbutter  April 29, 2007 4:13 am

    There’s also upload_column.

    After using all the others (except fleximage) this one is my favourite. Much better documentation than attachment_fu, very simple to use, a lot like filecolumn but with a much more elegant way of retrieving image urls for your views.

    You do it like so: @mypost.image.url

    Or to get a thumbnail version @mypost.image.medium_thumbnail.url

    The only difficulty i had with it was that my application wouldn’t start in production mode on media temple’s gridserver until i removed the plugin :(

  4. José Valim  May 5, 2007 10:41 am

    I’ve tried all above but I prefer upload column too!

    It provides methods to manipulate images on the fly or when storing it with RMagick!

    You can use procs to set your filename and store dir!
    So you can make complex filenames if you don’t want everyone accessing your pictures/files.

  5. Roj  June 9, 2007 3:09 am

    Found another good link on the topic here:

    They go into a little more detail about how to override plugin

  6. Justin Cunningham  February 24, 2008 11:01 am

    My company has a LGPL flash applet and rails plugin that makes it very easy to upload multiple files. It’s extensively documented and can be customized straight from Rails. In addition, the coloring can be changed with standard CSS files. Check it out at

  7. Alex Wayne  April 6, 2008 9:18 pm

    Just letting people know that I have released a new version of Fleximage that solves both of those listed cons.

    Image filename, width and height will automatically be stored in the database if you have the columns withe the right names. It works just like created_at and just gets filled in for you.

    And the default image file directory storage uses creation date based sub directories. So instead of an image being at path/to/images/999.jpg, it will now be at path/to/images/2008/04/03/999.jpg. So now you will only get directory overflow errors if you get many thousands of uploads per day. If thats the case you have greater optimization concerns.

    Get the new totally rewritten from scratch version here:

  8. roobnoob  April 10, 2008 12:54 pm

    Question. How does one deal with large file uploads thread-wise? Since rails is not thread-safe, there’s only one thread running per process. If you’ve got an upload that might take a few minutes, that particular process can’t do the other work (right?). So does one just fire up a large pack of processes?

  9. roobnoob  April 10, 2008 2:13 pm

    To Alex Wayne:

    Alex, try to design the plugin so that the location of the uploaded file is parametrized in some fashion. This should be determined by the user of the api, not internally in the api. This will make it much more flexible.

  10. michal  May 15, 2008 4:43 pm

    hm, do you have any workaround for mongrel instance hanging while the file is being uploaded ?

  11. Lance  September 3, 2008 9:09 pm


    Thanks for creating all of these great summaries of todays best programming secrets, I use your site a lot.

    I’ve integrated the attachment_fu plugin into the Ruboss “Flexible Rails” framework so you can upload files from Flex to Rails. Check out the Ruboss Tutorial


  12. Pawan  September 21, 2008 7:22 pm

    hi guys ,

    do you guys know any ruby plugin that uploads image but resizes the image in the client side before. it goes to the server and saves it.

  13. Anonymous  September 23, 2008 2:20 am


  14. Manikandan  October 13, 2008 9:54 pm

    I want to Know, how to get the uploaded file format eg..(.zip or .jpg ,etc,…)

  15. Amy  March 23, 2009 7:43 pm

    What about other files types? I want users to upload pictures, pdf’s, text, html, and be able to view them…

  16. Praveen Aithal H  May 26, 2009 6:18 am

    It really helped me. Thanks..

    But is it dependent on browser or independent!!??
    It changs its behaviour when i shift from one browser to another.. I don think it is dependent on OS, right!!?
    Plz help

  17. Flex Expert  May 26, 2009 9:39 am

    Thanks for the post…very useful…
    Saguenay-IT, (IT Outsourcing, SOA, PHP, ASP, Flex, ActionScript, JavaScript…)

  18. omg_pro  June 29, 2009 9:23 pm


  19. coach factory outlet  November 25, 2010 12:43 am

    Your articles was not praise therapists, others can’t add one word.


Direct TV Offers - usdirect has the best directtv deals