If you’re going to upload files via an HTML form, the form’s encoding must be set to multipart/form-data. In Rails, you use a helper method to generate the form tags, so you can’t directly edit them. The preferred helper is form_for; that’s what scaffold generates.
Normally, a form_for call would look like this:
<% form_for(@entry) do |f| %> <!-- Form fields --> <% end %>
To make this form be multipart, change the call to the following:
<% form_for(@entry, :html => {:multipart => true}) do |f| %>
<!-- Form fields -->
<% end %>
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment