# Form\_remote\_tag with multipart/form-data

**URL:** <https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878>\
**Category:** Rails\
**Created:** [July 3, 2006, 2:18am UTC](https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878 "2006-07-03T02:18:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [July 3, 2006, 2:18am UTC](https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878/1 "2006-07-03T02:18:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [July 3, 2006, 2:37am UTC](https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878/2 "2006-07-03T02:37:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [July 3, 2006, 2:49am UTC](https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878/3 "2006-07-03T02:49:08Z")

</div>

On 7/2/06, Stephan W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

---

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [July 3, 2006, 3:26am UTC](https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878/4 "2006-07-03T03:26:00Z")

</div>

On 7/2/06, Ricardo C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 [Peak Obsession](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.

---

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [July 6, 2006, 11:32pm UTC](https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878/5 "2006-07-06T23:32:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [July 6, 2006, 11:38pm UTC](https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878/6 "2006-07-06T23:38:25Z")

</div>

doesn’t work for security reasons.  
[http://svn.kylemaxwell.com/form\_remote\_upload/trunk/](http://svn.kylemaxwell.com/form_remote_upload/trunk/)

---

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [July 3, 2006, 2:51am UTC](https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878/7 "2006-07-03T02:51:51Z")

</div>

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 [Peak Obsession](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}) %\>

---

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [July 11, 2006, 4:36am UTC](https://www.ruby-forum.com/t/form-remote-tag-with-multipart-form-data/96878/8 "2006-07-11T04:36:53Z")

</div>

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/](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://lists.rubyonrails.org/pipermail/rails/2006-March/029329.html)  
[http://comox.textdrive.com/pipermail/talk/2006-April/000982.html](http://comox.textdrive.com/pipermail/talk/2006-April/000982.html)  
[http://blog.gmane.org/gmane.comp.lang.ruby.rails/day=20060413](http://blog.gmane.org/gmane.comp.lang.ruby.rails/day=20060413)
