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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---