Rails File Uploading 101
Mike Clark has put together a stunningly simple tutorial covering how to create a complete file uploading and image resizing system in mere minutes using Rick Olson's attachment_fu plugin. What impresses me the most is that he shows how attachment_fu can automatically store uploaded files on Amazon's S3 service with only a few tweaks. This is a must read for Rails developers who haven't brushed up on their file upload techniques lately.
March 2, 2007 at 3:40 am
I posted a quick response to Mike's tutorial here:
http://isaac.org.nz/2007/2/25/image-processing-with-attachment_fu
It outlines why I ended up going with mini_magick as an image processor.
March 2, 2007 at 4:46 am
One thing Mike didn't mention is that there seem to be issues using attachment_fu with Windows:
http://railsweenie.com/forums/3/topics/1257
It seems to have trouble saving the correct size of the files. Acts_as_attachment seems to work correctly, but something's up in attachment_fu.
March 2, 2007 at 12:53 pm
I'll second the problem on Windows... haven't found a fix yet.
March 2, 2007 at 2:49 pm
Ahh, this is very nice indeed. Little has been documented about this plugin. Rick hadn't even written much in the README yet.
This rocks.
March 2, 2007 at 11:17 pm
Neat! I added photo upload to our site using these instructions (modified for our models) in under an hour, and it worked the first time!
March 6, 2007 at 1:28 pm
All of the file upload examples that I've found seem to be geared toward image uploads. How well does something like attachment_fu work for non-image uploads? Is there something better for handling arbitrary file types?
March 6, 2007 at 2:45 pm
Should be fine, Don. Most upload plugins are for arbitrary files, it's just that because image uploads are so popular.. they provide short cuts and useful methods for that.
March 6, 2007 at 9:44 pm
If I set attachment_fu to store uploaded files in the file system, it puts them in the 'public' directory of the Rails app. I can specify a path for uploads, but it's relative to 'public'. My app is going to be deployed on a multi-user system, so I need to store files in a path relative to ~username. Is there a plug-in that allows that?