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]
for example:
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?