Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-15-2004, 11:24 PM   #1
Jose Muņiz
Registered: Jul 2003
Location: Mexico City
Distribution: Slackware 9.1, SuSE 9.1
Posts: 248

Rep: Reputation: 32
Determining MIME Type of a File

I have a quick question... where is the MIME Type of a file stored? According to what I've read, it's not in the inode. (Why not?).

Now, I don't think it is determined based on the extension of the file, because I have files named without extensions and they have their MIME Type correctly defined.

Thank you for your help
Old 08-16-2004, 02:04 AM   #2
Registered: Jul 2001
Distribution: Slackware 12
Posts: 511

Rep: Reputation: 32

file name_of_file
Old 08-16-2004, 02:44 AM   #3
Senior Member
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
most programs use the extension to get the file type (stupid programs. ... should be shot)

anyways .. its faster to get the file type by the extension .. but in case of certain programs, its best to use the hearer of the file to determine what to do with it (like a file manager, should display files based on there extension for speed, and execute the program based on header value, as to not evidently run a mpg as a web page,.............)

anyways, in the first part of most file types (except plain text) they usually have a special number, or word thats common to all files of that type (look at the file manager worker .. it determines file types this way .. you can set up a file type by telling it to look at 3 files, it compares the heads of all these files and takes what is common in all and uses that to determine of a file is of that type)

anyways, with shared mime info from , it stores both extension, and i believe what is called magic numbers (the header common to all files of this type you could say) ....


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't find Mime Type cootetom SUSE / openSUSE 20 08-16-2005 02:58 PM
CGI in C: need help determining mime types of files Sm0k3 Programming 1 01-26-2004 11:55 PM
how do I change mime type? brian_eye Linux - Newbie 2 06-10-2002 10:14 AM
Mime type settings saravanan1979 Linux - Newbie 0 04-15-2002 06:53 AM
Missing MIME type odat Programming 1 08-16-2001 06:54 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration