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
> 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:
>

IIRC it relies on the information supplied by the client (if any). When I
had the same problem, rather than try to verify it was a jpg, I just
converted it to a GD file then back to a jpeg.


C.
.



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.
    ... > 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)
  • Re: How reliable is mime type in $_FILES superglobal.
    ... Part of the array within $_FILES superglobal gives the mime type for the file. ... If the mime type says the file type is jpeg is it always right? ... MIME type is determined based on the file's extension. ...
    (comp.lang.php)
  • Re: File extensions are fun
    ... I read it as "You download a JPEG but because the server is misconfigured ... you download test.exe with MIME type set to ... I guess it's a question of whether you trust the extension or the MIME type ...
    (uk.comp.sys.mac)