How to upload file by ajax

Hey' How to upload file with ajax in ROR? My code not working :frowning: 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

Hey' How to upload file with ajax in ROR?

You can't, because javascript doesn't have access to the filesystem. There's a trick you can play with an invisible iframe, you should be able to find it with a quick google.

Fred