Ruby Forum Ruby on Rails > file validations

Posted by Sunny Bogawat (sunny_bogawat)
on 09.05.2008 06:45
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 !