# file upload problem when using form\_remote\_tag

**URL:** <https://discuss.rubyonrails.org/t/file-upload-problem-when-using-form-remote-tag/26300>\
**Category:** rubyonrails-talk\
**Created:** [March 14, 2008, 6:16am UTC](https://discuss.rubyonrails.org/t/file-upload-problem-when-using-form-remote-tag/26300 "2008-03-14T06:16:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [March 14, 2008, 6:16am UTC](https://discuss.rubyonrails.org/t/file-upload-problem-when-using-form-remote-tag/26300/1 "2008-03-14T06:16:54Z")

</div>

Hi &nbsp;&nbsp;&nbsp;&nbsp;I have a form like \<%= form\_remote\_tag :url =\> { :action =\> 'attach\_file', &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:id =\> @sd\_ticket.id }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:enctype =\> 'multipart/form-data' %\>

\<table cellpadding="4" cellspacing="0" border="0" width="100%" class="itiltable2"\>

\<tr\> &nbsp;&nbsp;&nbsp;&nbsp;\<td width="25%"\>\<%= text\_area "service\_desk\_attachment1", "description", "cols" =\> 50, "rows" =\> 1 %\>\</td\>

&nbsp;&nbsp;&nbsp;&nbsp;\<td width="25%" colspan="4"\>\<%= upload\_column\_field 'service\_desk\_attachment1', 'attachment' %\>\</td\>

\</tr\> \<button type="submit" value="save" \>Attach File\</button\> \<%=end\_form\_tag %\>

This is not working (the file not uploaded) WHAT I GET ON THE CONTROLLER IS AS A RESULT OF

puts params[:service\_desk\_attachment1][:description] puts params[:service\_desk\_attachment1][:attachment] IS

file1 D:\Sijo\file1.txt

BUT THE SAME WAS WORKING WITH THE FOLLOWING .ie JUST WHEN IT WAS start\_form\_tag instead of form\_remote\_tag as

\<%= start\_form\_tag ({:action =\> 'attach\_file', :id =\> @sd\_ticket.id, :method =\> 'post'}, :enctype =\> 'multipart/form-data')%\>

THE ABOVE IS WORKING(the file not uploaded), AND I GET IN THE CONTROLLER file1 #\<StringIO:0x47cee90\>

WHY THIS HAPPENS PLEASE HELP Sijo

---

<div class="post-metadata">

**Author:** ![Mike\_Garey](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@Mike\_Garey](https://discuss.rubyonrails.org/u/Mike_Garey)\
**Post date:** [March 14, 2008, 7:20am UTC](https://discuss.rubyonrails.org/t/file-upload-problem-when-using-form-remote-tag/26300/2 "2008-03-14T07:20:43Z")

</div>

as far as I know, you can't upload files through an AJAX call. Also, start\_form\_tag is deprecated, so you shouldn't use that anymore.

Mike

---

<div class="post-metadata">

**Author:** ![Arpit\_Jain1](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Arpit\_Jain1](https://discuss.rubyonrails.org/u/Arpit_Jain1)\
**Post date:** [March 14, 2008, 7:36am UTC](https://discuss.rubyonrails.org/t/file-upload-problem-when-using-form-remote-tag/26300/3 "2008-03-14T07:36:51Z")

</div>

use form\_tag

---

<div class="post-metadata">

**Author:** ![maerzbow](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@maerzbow](https://discuss.rubyonrails.org/u/maerzbow)\
**Post date:** [March 14, 2008, 12:15pm UTC](https://discuss.rubyonrails.org/t/file-upload-problem-when-using-form-remote-tag/26300/4 "2008-03-14T12:15:49Z")

</div>

yes, there is way but you have to use the "iframe remoting pattern" to do that

This great tutorial was a great help (just a walktrough): [http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment\_fu-and-responds\_to\_parent](http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent)

maerzbow [http://blog.odeley.com](http://blog.odeley.com)

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [March 19, 2008, 6:48am UTC](https://discuss.rubyonrails.org/t/file-upload-problem-when-using-form-remote-tag/26300/5 "2008-03-19T06:48:41Z")

</div>

Hi &nbsp;&nbsp;And finally I suceeded in the file upload (ajaxway) using responds\_to\_parent,uploadcolumn with iframe remoting pattern

Thanks for your help Sijo
