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 %>
Choose file : :
<%= file_field ‘upload’, ‘datafile’, :size => ‘60’ %>
<%= submit_tag “Upload” %>
<% end %>
Controller :
def uploadFile
@post = DataFile.save( params[:upload])
if @post
render :partial => ‘data’, :object => @post
end
end