Hey' How to upload file with ajax in ROR? My code not working View file : <% form_remote_tag(:url => { :controller => 'Upload', :action => 'uploadFile'}, :update => "result", :position => :bottom :html => {:multipart => true} ) do %> <p><label for="upload_file">Choose file :</label> : <%= file_field 'upload', 'datafile', :size => '60' %></p> <%= submit_tag "Upload" %> <% end %>
Controller : def uploadFile @post = DataFile.save( params[:upload]) if @post render :partial => 'data', :object => @post end end