In my Rails web application, I have to upload audio and video files and for validating against invalid file types, I have used jquery-validation engine
and I could do the same successfully. But, if I create a text file and change the extension from .txt
to .mp3
, e.g. test.txt
to test.mp3
, it will be taken as valid by jquery validation engine as the file extension is valid for an audio.
I want to check the content type also. When I opened the test.mp3
in a player, it showed me an error message Stream contains no data
. I want this kind of validation to be performed in the interface. Is it possible in Rails?
I'm using,
Rails 3.2.13
Ruby 2.0.0-dev
Hope anyone can help me out. Thanks :)-