Does form_remote_tag supports multipart/form-data ? My form looks like this: <%= form_remote_tag :url => { :action => ''do_image_upload'' }, :html => { :enctype => ''multipart/form-data'' } %> <%= file_field ''image'', ''file_data'', :size => 32 %> <%= submit_tag ''Upload'' %> <%= end_form_tag %> and produces: <form action="/home/do_image_upload" enctype="multipart/form-data" method="post" onsubmit="new Ajax.Request(''/home/do_image_upload'', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;"> <input id="image_file_data" name="image[file_data]" size="32" type="file"> <input name="commit" value="Upload" type="submit"> </form> but when I take it for a spin params[:image][:file_data] is nil. None of the image uploading howtos I''ve read use form_remote_tag, is this why? Thanks for any insight. -- Greg Donald http://destiney.com/
What are you trying to do? When I came across this I set up an invisble IFrame. I used an ordinary form with a target which is the IFrame. Then I assembled a javascript response on the server which gets put in the IFrame and manipulates the browser window as I needed to. Stephan Greg Donald wrote:> Does form_remote_tag supports multipart/form-data ? > > My form looks like this: > > <%= form_remote_tag :url => { :action => ''do_image_upload'' }, > :html => { :enctype => ''multipart/form-data'' } %> > <%= file_field ''image'', ''file_data'', :size => 32 %> > <%= submit_tag ''Upload'' %> > <%= end_form_tag %> > > and produces: > > <form action="/home/do_image_upload" enctype="multipart/form-data" > method="post" onsubmit="new > Ajax.Request(''/home/do_image_upload'', {asynchronous:true, > evalScripts:true, parameters:Form.serialize(this)}); > return false;"> > <input id="image_file_data" name="image[file_data]" size="32" > type="file"> > <input name="commit" value="Upload" type="submit"> > </form> > > but when I take it for a spin params[:image][:file_data] is nil. > > None of the image uploading howtos I''ve read use form_remote_tag, is > this why? > > Thanks for any insight.-- Posted via http://www.ruby-forum.com/.
On 7/2/06, Stephan Wehner <stephan@buckmaster.ca> wrote:> What are you trying to do?I was using form_remote_tag because I need to run an RJS template after the image upload.> When I came across this I set up an invisble > IFrame. I used an ordinary form with a target which is the IFrame. Then > I assembled a javascript response on the server which gets put in the > IFrame and manipulates the browser window as I needed to.Using an iframe had crossed my mind as a last resort. -- Greg Donald http://destiney.com/
Ricardo Cabral
2006-Jul-03 00:52 UTC
[Rails] Re: Re: form_remote_tag with multipart/form-data
do you have the output from the web-server as you try to submit the form? the params appear there, so maybe that can give you a clue. i use http://manuals.rubyonrails.com/read/chapter/79 (use google cache if you get an error) and it works fine. by the way, multipart is available as an option: <%= start_form_tag ({:action=> "add"}, {:multipart => true}) %> -- Posted via http://www.ruby-forum.com/.
Greg Donald
2006-Jul-03 01:25 UTC
[Rails] Re: Re: form_remote_tag with multipart/form-data
On 7/2/06, Ricardo Cabral <nightdog@mail.telepac.pt> wrote:> do you have the output from the web-server as you try to submit the > form? the params appear there, so maybe that can give you a clue.irb(#<HomeController:0x255f32c>):001:0> params[:image] => {"description"=>"dsfg", "friendly_name"=>"sdfg"} irb(#<HomeController:0x255f32c>):002:0> params[:image][:file_data] => nil> i use http://manuals.rubyonrails.com/read/chapter/79 (use google cache > if you get an error) and it works fine. > > by the way, multipart is available as an option: > <%= start_form_tag ({:action=> "add"}, {:multipart => true}) %>Right. But I''m trying to use form_remote_tag. -- Greg Donald http://destiney.com/
Ricardo Cabral
2006-Jul-06 21:32 UTC
[Rails] Re: Re: Re: form_remote_tag with multipart/form-data
right. sorry I have the same problem, and from the error page i can see that the file_data parameter isn''t passed to the server. I tried using file_field_tag and passing it as a parameter out of image but the file_data just doesn''t get trough the form. Maybe this is a bug? -- Posted via http://www.ruby-forum.com/.
Ricardo Cabral
2006-Jul-06 21:38 UTC
[Rails] Re: Re: Re: form_remote_tag with multipart/form-data
doesn''t work for security reasons. http://svn.kylemaxwell.com/form_remote_upload/trunk/ -- Posted via http://www.ruby-forum.com/.
Larrytheliquid
2006-Jul-11 02:33 UTC
[Rails] Re: Re: Re: form_remote_tag with multipart/form-data
In Rails 1.1 (for me and for some others that I''ve read about) the upload portion of this works. Using a breakpoint also indicates that you get inside of the RJS file. However, things like page.replace, page.alert, etc will not work. Does anyone have a fix for the plugin? link to plugin: http://svn.kylemaxwell.com/form_remote_upload/trunk/ links to others with the same problem: http://lists.rubyonrails.org/pipermail/rails/2006-March/029329.html http://comox.textdrive.com/pipermail/talk/2006-April/000982.html http://blog.gmane.org/gmane.comp.lang.ruby.rails/day=20060413 On 7/6/06, Ricardo Cabral <nightdog@mail.telepac.pt> wrote:> > doesn''t work for security reasons. > http://svn.kylemaxwell.com/form_remote_upload/trunk/ > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Respectfully: Larry Diehl -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060711/90ea3ade/attachment-0001.html