ruby on rails - How to limit only images to be uploaded through file_field tag? -
<%= form_for @model_name, :url => {:controller => 'controller_name', :action => 'index'},:html => {:multipart => true},:validate => true |f| %> <%= file_field 'upload', 'datafile'%> <% end %> i have form. want upload images through upload. how this?
you can use paperclip gem manage file attachments. has validates_attachment validator helpful.
validates_attachment :avatar, :presence => true, :content_type => { :content_type => "image/jpg" }, :size => { :in => 0..10.kilobytes }
Comments
Post a Comment