2
finfo_*
and pathinfo
are used to detect the mimetype file and not the extension.
The point is that in the world there are several file formats and from time to time new formats appear, I have no way to make a test to know which function has better support for mimetypes detection, that is is an impracticable test to do due to the amount of file formats, what I have doubt is about which of these functions has better support.
Question:
Which of these functions has better support for detecting mime-types from files?
Which is best maintained by PHP?
The
pathinfo
is used for information on the file path, already the functionsfinfo_*
are used to obtain information about the archive. =) So thepathinfo
doesn’t catch the mime-type, but yes, the extension. 1) In this case usefinfo_*
. 2) Thefinfo_*
is supported since version 5.3.0 and thepathinfo
4.0.3. Also consider the methodgetExtension
classSplFileInfo
from the 5.3.6 to get the extension. To finish, about thefinfo_*
see this page.– stderr
@qmechanik Kkkkkk I traveled, I thought
pathinfo
took the mimetype too– Guilherme Nascimento
I formulated an answer. =)
– stderr