<%= form_for @model_name, :url => {:controller => 'controller_name', :action => 'index'},:html => {:multipart => true},:validate => true do |f| %>
<%= file_field 'upload', 'datafile'%>
<% end %>
I have this form. I want to upload only images through this upload. How to do this?
You can use paperclip gem to manage file attachments. It has
validates_attachmentvalidator which would be helpful.