RE: [PHP] Encoding for uploaded files
| From: | memoimyself at yahoo dot com dot br | Date: | Thu, 29 Jan 2004 19:02:40 +0000 |
| Subject: | RE: [PHP] Encoding for uploaded files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-176249@lists.php.net to get a copy of this message | ||
On 29 Jan 2004 at 10:47, craig wrote:
> specifally, you want: $_FILES['userfile']['type'] = The mime type of
> the file, if the browser provided this information. An example would
> be "image/gif".
That's basically it and will work for common file types. However, it's the user's
browser,
not PHP, that identifies the MIME type of the file and sends this information along with
the file. This means, first, that some browsers will send you the information (or the
*correct*) information while others may not, and, second, that some file types will not be
recognized by the user's browser and the file type available to PHP will be an empty
string. So, as you can see, you can't really rely on this kind of information for anything
critical to your application.
Cheers,
Erik