file validations

Sunny Bogawat
Fri, 09 May 2008 04:45:53 -0000

i am developing one application in which user uploaded one csv template
to my system(file). but we have to take care that user should uploaded
.csv file only if he trying to upload another file we have to restrict
it.
how to check for extention in ruby on rails ya there is another solution
for it?
i am doing something like
 file_name =params[:group_member_information].original_filename
      begin
        f = File.new("#{path}/#{file_name}", "wb")
        str = params[:group_member_information].read
        f.write str
        f.close

  please reply !
--
Posted via http://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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---