when you upload files, you can then get the necessary data from $_FILES files contains the list of file inputs, where each one has a field like [type]
Array ( [file1] => Array ( [name] => 'MyFile.txt' [type] => text/plain //where does this come from? [tmp_name] => /tmp/php/php1h4j1o [error] => UPLOAD_ERR_OK [size] => 123 ) )
does it come from within the file, or the file extension, or somewhere else? how does php get the type? where does the [type] come from and can I trust it as valid?
from the manual:
The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki