# Validate file format: not by extension

**URL:** <https://www.ruby-forum.com/t/validate-file-format-not-by-extension/165014>\
**Category:** Rails\
**Created:** [April 8, 2009, 8:22am UTC](https://www.ruby-forum.com/t/validate-file-format-not-by-extension/165014 "2009-04-08T08:22:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brijesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@brijesh](https://www.ruby-forum.com/u/brijesh)\
**Post date:** [April 8, 2009, 8:22am UTC](https://www.ruby-forum.com/t/validate-file-format-not-by-extension/165014/1 "2009-04-08T08:22:00Z")

</div>

Hi All,

I want to validate a file format before uploaded on server.

I know it can be validate by content-type or using regex.  
But I wonder if someone change the extension of file and then uploaded  
it…

I have to validate only two format: 1) wav 2) gsm

Thanks
