Hi and thanks in advance.
I run apache 2.2.22 , php 5.3.10-10 in Ubuntu 12.04.
I have been working through the chapter13 Review and Pursue topics . The Pursue 4/5th topics suggest modifying the upload_rtf.php code. I have added code to display the name, type and size of a file that has been offered for uploading.
I get some unexpected and inconsistent results for MIME types for an RTF file type and also some other file types. The relevant code is:
//indicate it's OK: also print file MIME type
echo '<p><em>The ' . finfo_file($fileinfo, $_FILES['upload']['tmp_name']) . ' file would be acceptable.</em></p>';
//print_r($_FILES['upload']) ; //just testing the array
echo '<p><em>The file <b>' . $_FILES['upload']['name'] . '</b> is a MIME type ' . $_FILES['upload']['type'] . '. The file size is ' . $_FILES['upload']['size'] . ' bytes.</em></p>';
When the code is executed in the browser (Firefox 17.0.1):
An rtf file is given as text/rtf by one line then application/rtf by the next line.
A php file is given as text/x-php on the first line then application/x-php by the second line.
However, a jpg or gif file is given as image/jpg or image/gif on both lines.
I have looked around the 'net for explanations, but haven't found anything that led to an understanding of how this occurs.
Can anybody suggest why this should be?