+1 on Mike's suggestion - otherwise, you'll get users RENAMING their .doc file to end with .csv and uploading it over and over... :)
--Matt Jones On Oct 8, 11:47 am, John Mcleod <[email protected]> wrote: > Hello all, > I'm trying to validate a uploaded file extension. I'm not using any > special plugin other that fastercsv. > > When I try to upload an incorrect file (say a ".doc"), I get this error > message... > "Error adding logs. (Unquoted fields do not allow \r or \n (line 2).). > Please try again." > > Below is my model. > > -model- > class Import < ActiveRecord::Base > validates_format_of :import, :with => /^.+\.(csv)$/, > :message => 'A .csv file is required.' > end > > It should work but it doesn't. > > Any help with this is greatly appreciated. > Thank you. > > JohnM > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

