Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fileinfo and mime types I've never heard of

Tags:

php

fileinfo

I'm not a stranger to mime types but this is strange. Normally, a text file would have been considered to be of text/plain mime but now, after implementing fileinfo, this type of file is now considered to be "text/x-pascal". I'm a little concerned because I need to be sure that I get the correct mime types set before allowing users to upload with it.

Is there a cheat sheet that will give me all of the "common" mimes as they are interpreted by fileinfo?


Sinan provided a link that lists all of the more common mimes. If you look at this list, you will see that a .txt file is of text/plain mime but in my case, a plain-jane text file is interpreted as text/pascal.

like image 431
Jim Avatar asked Dec 18 '22 02:12

Jim


1 Answers

fileinfo is a "best guess". It analyzes only a portion of the file in order to try to figure out what type the file is, and as such it can be fooled easily enough. Perhaps your file starts with a Pascal comment or keyword such as Project or Unit.

like image 160
Ignacio Vazquez-Abrams Avatar answered Jan 07 '23 17:01

Ignacio Vazquez-Abrams