# File validations

**URL:** <https://www.ruby-forum.com/t/file-validations/196674>\
**Category:** Rails\
**Created:** [May 9, 2008, 6:45am UTC](https://www.ruby-forum.com/t/file-validations/196674 "2008-05-09T06:45:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [May 9, 2008, 6:45am UTC](https://www.ruby-forum.com/t/file-validations/196674/1 "2008-05-09T06:45:53Z")

</div>

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 !
