Does anyone know if it''s possible to set constraints to the size & type of file that file_column will accept? I''d like to limit to image files of less than 2MB. If this isn''t possible with file_column, is there a graceful way of getting the controller to handle it? thanks dorian -- -- I do things for love or money
validates_file_format_of :name, :in => ["gif", "jpg", "png"] validates_filesize_of :field, :in => 0..2.megabytes Gokhan www.sylow.net dorian mcfarland wrote:> Does anyone know if it''s possible to set constraints to the size & type > of file that file_column will accept? > > I''d like to limit to image files of less than 2MB. > > If this isn''t possible with file_column, is there a graceful way of > getting the controller to handle it? > > thanks > > dorian-- Posted via http://www.ruby-forum.com/.
perfect, thank you. they aren''t in the API are they? I did look, honest. dorian Gokhan Arli wrote:> validates_file_format_of :name, :in => ["gif", "jpg", "png"] > validates_filesize_of :field, :in => 0..2.megabytes > > Gokhan > www.sylow.net > > > dorian mcfarland wrote: >> Does anyone know if it''s possible to set constraints to the size & type >> of file that file_column will accept? >> >> I''d like to limit to image files of less than 2MB. >> >> If this isn''t possible with file_column, is there a graceful way of >> getting the controller to handle it? >> >> thanks >> >> dorian > >-- -- I do things for love or money
aah, ok, I just found the validations file in the plugin. I''ll look harder next time. thanks again Dorian Mcfarland wrote:> perfect, > thank you. > > they aren''t in the API are they? > I did look, honest. > > dorian > > Gokhan Arli wrote: >> validates_file_format_of :name, :in => ["gif", "jpg", "png"] >> validates_filesize_of :field, :in => 0..2.megabytes >> >> Gokhan >> www.sylow.net >> >> >> dorian mcfarland wrote: >>> Does anyone know if it''s possible to set constraints to the size & >>> type of file that file_column will accept? >>> >>> I''d like to limit to image files of less than 2MB. >>> >>> If this isn''t possible with file_column, is there a graceful way of >>> getting the controller to handle it? >>> >>> thanks >>> >>> dorian >> >> >-- -- I do things for love or money