Browse the Ruby on Rails Community.

You are here: Browse Railsplugins Fake Ajax Upload

Fake Ajax Upload

EXAMPLE:

=== VIEW ===

<%= form_tag_with_fake_ajax_upload({ :action => ‘add_images’, :id => @post }, { :begin => ”$(‘ImageSpinner’).show()” }) %> <%= file_field_tag “image”, :size => ‘15’ %>

&lt;= submit_tag "Upload" %>&nbsp;Or&nbsp;&lt;= link_to_function 'Close', 'page.closeToolbox()', :class => 'classicLink' %>

<%= end_form_tag %>

=== CONTROLLER ===

def add_images
  @post = BlogPost.find(params[:id])
  unless @post.nil?
    @post.add_image(params[:image])
    @post.save
  end
end
render_rjs_after_upload :action => 'add_images'

=== MODEL: POST

has_many_files :images, :class_name => ‘Image’, :unzip => true, :order => ‘position ASC’, :dependent => :destroy

NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly

Users


See all details


Membership

+ Join this railsplugin

Record Maintainer

'None'