Form_remote_tag with multipart/form-data

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:

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.

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 D. 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:

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.

On 7/2/06, Stephan W. [email protected] 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.

On 7/2/06, Ricardo C. [email protected] 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.

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?

doesn’t work for security reasons.
http://svn.kylemaxwell.com/form_remote_upload/trunk/

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}) %>

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

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