Attempting ajax file upload

I have this basic code in place and it is giving me an:
“undefined local variable or method `end_form_tag’ for
#ActionView::Base:0x41a2094

Note sure why I am getting the error as it is straight from:

view:

<%= form_remote_tag(:url => { :controller => “image_demo”, :action =>
“create” }, :html => {:multipart => true}) %>
Picture: 
<%= file_field_tag “asset” %> 
<%= submit_tag “Upload” %> 
<%= end_form_tag %>

remote_uploads.rb in lib directory:

module ActionView
module Helpers
module PrototypeHelper
#alias_method :form_remote_tag_old, :form_remote_tag
def form_remote_tag(options = {}, &block)
unless options[:html] && options[:html][:multipart]
form_remote_tag_old(options, &block)
else
uid = “a#{Time.now.to_f.hash}”
<<-STR
enctype=“multipart/form-data” target="#{uid}" #{%(onsubmit="#
{options[:loading]}") if options[:loading]}
>
STR

    end
  end
end

end
end

On Jul 27, 4:21 am, Me [email protected] wrote:

I have this basic code in place and it is giving me an:
“undefined local variable or method `end_form_tag’ for
#ActionView::Base:0x41a2094

Because end_form_tag was removed from rails 2.0

Fred

Ok, I changed to this but it is posting normally and not ajax for some
reason. i see in the source that it is supposed to do an ajax submit.
<% form_remote_tag(:url => { :controller => “image_demo”, :action =>
“create” }, :html => {:multipart => true}) do %>
Picture: 
<%= file_field_tag “asset” %> 
<%= submit_tag “Upload” %> 
<% end %>

On Sun, Jul 26, 2009 at 10:52 PM, Frederick C. <

Stumped, the ajax submit works but does not pass the file param for
some reason.

<% fields_for :file, :html => { :multipart => true, :target=>"upload_file" } do %> Picture:  <%= file_field_tag :upload %>  <%= submit_to_remote 'up',"Upload", :method=>'post', :url => { :controller => "rfi", :action => "sendfile", :id => @rfi }, :target=>"upload_file" %>  <% end %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs