Flowdock
file_field_tag(name, options = {}) public

Creates a file upload field.

If you are using file uploads then you will also need to set the multipart option for the form:

  <%= form_tag { :action => "post" }, { :multipart => true } %>
    <label for="file">File to Upload</label> <%= file_field_tag "file" %>
    <%= submit_tag %>
  <%= end_form_tag %>

The specified URL will then be passed a File object containing the selected file, or if the field was left blank, a StringIO object.

Show source
Register or log in to add new notes.
August 9, 2011
1 thank

HTML5 support

To support multiple file selection simply pass :multiple => true in the options hash:

file_field_tag 'file', :accept => 'image/jpeg', :multiple => true