Jumbalaya Wanton
Jumbalaya Wanton

Reputation: 1621

Ruby get mime-type based on extension

How can I get a mime-type based on a file extension?

Upvotes: 2

Views: 2903

Answers (1)

Mohamad
Mohamad

Reputation: 35339

If you are using Rails you can get the mime-type with Rack::Mime.

mime_type = Rack::Mime.mime_type(extension)

Upvotes: 7

Related Questions