Posted By

noah on 10/08/08


Tagged

forms upload helper haml formform enctype multipart


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

webstic


Multipart encoding (for file upload form) with the form_for Rails helper


 / Published in: Rails
 

URL: http://www.ruby-forum.com/topic/123062#547930

Set the enctype attribute of a form created with form_for. HAML markup below, but the same technique works in ERB.

  1. - form_for :springfield, :url => {:controller => 'homer', :action => 'drink_beer'}, :html => {:multipart => true} do |form|
  2. = form.file_field :path_to_beer
  3. = form.submit

Report this snippet  

You need to login to post a comment.