How reliable is mime type in $_FILES superglobal.



This may seem like a stupid question but I want to check before I go ahead and build this...

I am working on a portal, part of which allows users to upload files. Part of the array within $_FILES superglobal gives the mime type for the file. Is this 100% reliable / accurate? If the mime type says the file type is jpeg is it always right? Two reasons I want to know:

1. Certain types of files mustn't be uploaded, .exe files for example.
2. It is unsafe to rely on file extentions, not least because this portal will be exposed to Linux.


If the mime type is not reliable what techniques are available to discover the type of a file?

Many thanks.
.



Relevant Pages

  • Re: How reliable is mime type in $_FILES superglobal.
    ... >I am working on a portal, part of which allows users to upload files. ... >Part of the array within $_FILES superglobal gives the mime type for the ... There's functions that use heuristics to make a decent guess as to the format ...
    (comp.lang.php)
  • Re: How reliable is mime type in $_FILES superglobal.
    ... > I am working on a portal, part of which allows users to upload files. ... > Part of the array within $_FILES superglobal gives the mime type for the ... If the mime type says the file ... converted it to a GD file then back to a jpeg. ...
    (comp.lang.php)
  • Re: How reliable is mime type in $_FILES superglobal.
    ... > splodge wrote: ... >> I am working on a portal, part of which allows users to upload files. ... >> Part of the array within $_FILES superglobal gives the mime type for the ... If the mime type says the file ...
    (comp.lang.php)
  • Re: How reliable is mime type in $_FILES superglobal.
    ... splodge wrote: ... > I am working on a portal, part of which allows users to upload files. ... > Part of the array within $_FILES superglobal gives the mime type for the ... If the mime type says the file ...
    (comp.lang.php)
  • plain text file in aspx
    ... forgive me for this stupid question. ... If I change MIME type to "text/html" I obtain a file ... What is the correct MIME type? ...
    (microsoft.public.inetserver.iis)