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

  • SEARCH
  • Home
  • 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 8164003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:12:21+00:00 2026-06-06T19:12:21+00:00

I used to get different MIMI types when using finfo_open(FILEINFO_MIME_TYPE). For instance, based on

  • 0

I used to get different MIMI types when using finfo_open(FILEINFO_MIME_TYPE).

For instance, based on memory, I believe docx were application/vnd.openxmlformats-officedocument.wordprocessingml.document (see this StackOverflow post What is a correct mime type for docx, pptx etc?). I also recall them showing as application/zip, but that might have been when using mime_content_type(). Also, thought js files came up as application/x-javascript.

Below is what I am now getting along with the script to display them. I recently updated to PHP 5.14, and wonder if there is a new standard or whether I messed something up. I am fine with this, but will have to change my scripts which compared extensions to MIMI types.

EDIT – Just found the following on the PHP manual.

As of PHP >= 5.3.11 and >= 5.4.1 the magic datababase format has
changed. Due to this, the internal mime database was upgraded. This
affects especially the code where external magic is read in. Reading
in magic files of the older formats will not work. Also, some textual
representations of the mime types has changed, for instance for PHP
would be “PHP script, ASCII text” instead of “PHP script text”
returned.

Thank you

MIMI List based on below script

- directory
csv - text/plain
doc - application/msword
docx - application/msword
htm - text/html
ini - text/plain
jpg - image/jpeg
js - text/plain
mp3 - application/octet-stream
pdf - application/pdf
php - text/html
pptx - application/vnd.ms-powerpoint
pst - application/octet-stream
so - application/x-sharedlib
txt - text/plain
wmv - video/x-ms-asf
xls - application/msword
xlsx - application/vnd.ms-excel
zip - application/zip

PHP Code

<?php
$finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
foreach (glob("*") as $filename) {
    $files[pathinfo($filename, PATHINFO_EXTENSION)]=array('filename'=>$filename,'finfo'=>finfo_file($finfo, $filename));
}
ksort($files);
foreach ($files as $fileext=>$file) {
    echo ($fileext.' - '.$file['finfo'].'<br />');
}
finfo_close($finfo);
?>
  • 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-06-06T19:12:24+00:00Added an answer on June 6, 2026 at 7:12 pm

    The mime types printed will differ based on the system’s configuration. If the system is configured to open .docx files in MSWord, then it’ll have application/msword as the mime type. Likewise, if the same extension .docx is configured to open in LibreOffice, it’ll have application/vnd.openxmlformats-officedocument.wordprocessingml.document as the mime type.

    Because of this dependency on the server’s configuration, mime types are not very reliable.

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

Sidebar

Related Questions

A line in this answer , Get used to using the Mac on its
I'm using QTCreator on the Mac, and I'm trying to get used to it.
We know that page tables are used to get the physical memory page address
i used ftp-get function to download images from server. But by accident i used
I used to get a trouble with pthread_exit() . I know there is no
Whats query can be used to get the details of Indexes of any table?
I found that PageProxy can be used to get data from page, but I
I have a fairly simple pagination query used to get rows from a table
The AVAudioRecorder in the iPhone SDK can be used to get the peak and
When I try to install my software in some computers, I used to get

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.