Get content-type of file on rails
$ gem install mime-types irb(main):001:0> require 'mime-types' => true irb(main):002:0> MIME::Types.type_for("/Users/xxx/Downloads/sample_1920x1080.ts").first.content_type => "video/MP2T"
https://stackoverflow.com/a/7537309/1399891