![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.php archiveRe: How reliable is mime type in $_FILES superglobal.
From: Andy Hassall <andy@andyh.co.uk>
Date: Mon Jan 30 2006 - 23:11:45 CET
On Mon, 30 Jan 2006 21:05:38 +0000, splodge <splodge@blurryfox.com> wrote:
>I am working on a portal, part of which allows users to upload files.
It is user-supplied data, so is not trustworthy.
>If the mime type says the file type is jpeg is it always right?
No.
>Two reasons I want to know:
There is no reliable way to find the "type" of a file because files don't have
There's functions that use heuristics to make a decent guess as to the format
http://uk2.php.net/manual/en/ref.mime-magic.php
How it's supposed to work is that it doesn't matter what the data is, but
See: http://ppewww.ph.gla.ac.uk/~flavell/www/content-type.html , and then
-- Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis toolReceived on Tue Feb 7 21:08:00 2006 |