# Form\_tag versus form\_for with :multipart =\> true

**URL:** <https://www.ruby-forum.com/t/form-tag-versus-form-for-with-multipart-true/113311>\
**Category:** Rails\
**Created:** [August 29, 2007, 7:02pm UTC](https://www.ruby-forum.com/t/form-tag-versus-form-for-with-multipart-true/113311 "2007-08-29T19:02:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 29, 2007, 7:02pm UTC](https://www.ruby-forum.com/t/form-tag-versus-form-for-with-multipart-true/113311/1 "2007-08-29T19:02:19Z")

</div>

Consider the following two ways of doing forms, both with :multipart  
=\> true. Only  
the form\_for will work properly when using attachment\_fu

`
<%= form_tag :action => 'create', :multipart => true %>
  <%= file_field 'assignment', :uploaded_data %>
  <%= submit_tag "Create" %>
<%= end_form_tag %>
`

HTML:  
``

`
<% form_for :assignment, :url => {:action => 'create'}, :html =>
{:multipart => true}) do |f| %>
   <%= file_field :assignment, :uploaded_data %>
  <%= submit_tag "Upload Assignment" %>
<% end %>
`

HTML:

`

   
  

`

Only the second form works with attachment\_fu. Why are these two  
translations incompatible?  
I would expect the enctype to be specified on the first form above.

Thanks for any feedback,

Gordon

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 29, 2007, 7:19pm UTC](https://www.ruby-forum.com/t/form-tag-versus-form-for-with-multipart-true/113311/2 "2007-08-29T19:19:24Z")

</div>

On 8/29/07, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> \<%= submit\_tag "Upload Assignment" %\>

the :multipart specification goes into the options hash for the  
form\_tag, such as the following:

\<% form\_tag({:action =\> ‘settings’}, {:multipart =\> true, :class =\>  
“form-style2”} ) do -%\>  
…  
\<% end %\>
