I''am trying to send multipart with ajax like this <%= form_remote_tag :url => {:action => "upload" } %> <%= file_filed "user", "picture" %> <%= submit_tag %> <%= end_form_tag %> But when i try get @params[:user][:picture] the value is nil Anyone can help me Bruno -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I don''t know whether you can upload files via ajax, but you misspelt ''file_field''... might be part of the problem if this is copied & pasted from your code.. Bruno Malvestuto wrote:> I''am trying to send multipart with ajax like this > <%= form_remote_tag :url => {:action => "upload" } %> > > <%= file_filed "user", "picture" %> > > <%= submit_tag %> > <%= end_form_tag %> > > But when i try get @params[:user][:picture] the value is nil > > > > > > Anyone can help me > > > > Bruno > > > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 26 Aug 2006, at 14:29, Bruno Malvestuto wrote:> > I''am trying to send multipart with ajax like this > <%= form_remote_tag :url => {:action => "upload" } %> > > <%= file_filed "user", "picture" %> > > <%= submit_tag %> > <%= end_form_tag %> > > But when i try get @params[:user][:picture] the value is nilAJAX uploads are not supported out of the box, you can check this page for help: http://sean.treadway.info/demo/upload/ and http:// sean.treadway.info/svn/plugins/responds_to_parent/README Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Peter can you provide a simple example? Are you using file_column? Im not very familiar with javascript so Id like to see a real :update loop. Peter De Berdt wrote:> On 26 Aug 2006, at 14:29, Bruno Malvestuto wrote: > >> >> I''am trying to send multipart with ajax like this >> <%= form_remote_tag :url => {:action => "upload" } %> >> >> <%= file_filed "user", "picture" %> >> >> <%= submit_tag %> >> <%= end_form_tag %> >> >> But when i try get @params[:user][:picture] the value is nil > > AJAX uploads are not supported out of the box, you can check this > page for help: http://sean.treadway.info/demo/upload/ and http:// > sean.treadway.info/svn/plugins/responds_to_parent/README > > Best regards > > Peter De Berdt-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 27 Aug 2006, at 05:15, Jonathon Marshall wrote:> Peter can you provide a simple example? Are you using file_column? > Im not very familiar with javascript so Id like to see a real :update > loop.Install the plugin by entering "script/plugin install http:// sean.treadway.info/svn/plugins/responds_to_parent/" in the terminal. The readme of respond_to_parent will show you how to use it: http://sean.treadway.info/svn/plugins/responds_to_parent/README If you''re really uncomfortable with all of this, just use the normal form submit (don''t use ajax). It will be hard to maintain something if you don''t understand how it works. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Peter De Berdt wrote:> On 27 Aug 2006, at 05:15, Jonathon Marshall wrote: > >> Peter can you provide a simple example? Are you using file_column? >> Im not very familiar with javascript so Id like to see a real :update >> loop. > > Install the plugin by entering "script/plugin install http:// > sean.treadway.info/svn/plugins/responds_to_parent/" in the terminal. > > The readme of respond_to_parent will show you how to use it: > http://sean.treadway.info/svn/plugins/responds_to_parent/README > > If you''re really uncomfortable with all of this, just use the normal > form submit (don''t use ajax). It will be hard to maintain something > if you don''t understand how it works. > > > Best regards > > Peter De BerdtI''ve read the readme and even created a project thats exactly the same. This line results not one but two RJS template errors. page << "alert($(''stuff'').innerHTML)" -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> I''ve read the readme and even created a project thats exactly the > same. > This line results not one but two RJS template errors. > > page << "alert($(''stuff'').innerHTML)"Tsk tsk tsk, the readme is a quick and dirty draft, the form wasn''t set to multipart, but as soon as you replace it with rails style erb tags, everything runs fine. Example: class TestController < ApplicationController def main end def form_action # Do stuff with params[:uploaded_file] if params[:uploaded_file] responds_to_parent do render :update do |page| page << "alert(''#{params [:uploaded_file].original_filename}'')" end end else render :nothing => true end end end main.rhtml <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Test</title> </head> <body> <body> <div id="stuff">Here is some stuff</div> <%= start_form_tag({:action => ''form_action''}, :multipart => true, :target => "frame") %> <%= file_field_tag("uploaded_file")%> <%= submit_tag(''Save'')%> <%= end_form_tag %> <iframe id=''frame'' name="frame"></iframe> </body> </html> Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
You need include defaults javascript library to fix the rjs erors.>> >> Best regards >> >> Peter De Berdt > > I''ve read the readme and even created a project thats exactly the same. > This line results not one but two RJS template errors. > > page << "alert($(''stuff'').innerHTML)"-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---