Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 656005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:40:01+00:00 2026-05-13T22:40:01+00:00

Where could I find out the content type for a specific file format/extension? For

  • 0

Where could I find out the content type for a specific file format/extension?
For example, I know that an mp3 can be one of the following content types:

'application/mp3', 'application/x-mp3', 'audio/mpeg', 'audio/mp3'

What would be the content type for a zip file? Where would I find out that information for other content types?

I need this for purposes of validation with ruby on rail’s paperclip plugin.

Thanks!


Update: I just found this and thought it may be useful to other people

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:40:01+00:00Added an answer on May 13, 2026 at 10:40 pm

    I know that an mp3 can be one of the following content types

    Only audio/mpeg is valid. The rest are bogus and won’t generally work anywhere.

    What would be the content type for a zip file?

    application/zip.

    Where would I find out that information for other content types?

    The proper list of all registered media types is at IANA. Of course, there are many more types that have not been registered, largely those with the x prefix.

    If you want to find out on the fly what your machine thinks a particular extension is using a server-side script, you can find that in an OS-specific place. On Windows, the file extension/type information is stored in the Registry. On desktop Linux, it’s in /usr/share/mime. On an Apache web server, you might want to re-use Apache’s mime.types table.

    for a specific file format/extension?

    File extensions are unstandardised, and not a reliable way of checking the type of a resource on the web, including a file upload. File-extension-to-media-type mappings are an OS/installation-specific issue so you can’t know what media type a file is from extension on another machine. Furthermore, some operating systems don’t even use file extensions to determine type (or only use them as a fallback).

    Even looking at the Content-Type supplied with a file upload is of little use, since it’s so often wrong due to bad setup at the client side. I guess this is why the bogus types like application/mp3 have crept into the list above, because some time one browser somewhere on a badly-set-up machine sent the wrong type. But browsers can always send any old wrong type… you’re just as likely to get a text/plain MP3.

    If you need to allow the user to set a definitive content-type for the uploaded resource, you’ll have to let them manually pick it. Of course you can use a bit of script hacking to make useful guesses like “if it ends with .jpeg, it’s probably a JPEG” and make that selection automatically. But in the general case it is not reliable to guess type from user-submitted file extension.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How could I find out if a URL is available and usable to create
I could probably find this out from somewhere else but thought it would be
I tried searching around, but I couldn't find anything that would help me out.
Do you know where I could find some useful third party (free) code snippets
I can't find much information on const_cast . The only info I could find
I could only find the function confirm() that gives OK/Cancel buttons. Is there any
From what information I could find, they both solve the same problems - more
I could not find any pointers on how to create a menubar icon on
After having a search around I could not find exactly what I want, I
Thanks for reading this I thought I could use find(), but couldn't make it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.