[Rails] "AJAX" file uploading

Jeff Smick sprsquish at gmail.com
Fri Jan 27 22:56:10 GMT 2006


I'm pretty new to actually contributing to a software project outside of 
my own. I recently found the need to create an "ajax" uploader and 
thought I'd share it with the community.

I write "ajax" because it acts like it's ajax but we all know that 
javascript does not have filesystem access (for good reason) and thus 
ajax uploading isn't possible in the standard sense. This uses a 
technique borrowed from a Drupal module where by the form is targeted to 
a hidden iframe. The response gets wrapped just before being sent. The 
wrapper is essentially a javascript call that collects the response and 
sends it to a callback in the parent window where it can be processed in 
the normal prototype ways (insertion and such).

Please take a look. I didn't write any documentation for it (yet), but 
it's fairly self explanitory for those that have been using Rails for 
awhile. It's also very basic.

http://rubyforge.org/projects/ajax-upload/


BTW, if anyone would like to assist me on how to write better software 
I'd be most appreciative.

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list