note 75597 deleted from ref.fileinfo by mazzanet
| From: | mazzanet@php.net | Date: | Tue, 26 Apr 2011 09:42:58 +0000 |
| Subject: | note 75597 deleted from ref.fileinfo by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179143@lists.php.net to get a copy of this message | ||
Note Submitter: mwwaygoo AT hotmail DOT com
----
Be careful of using system("file -i -b file.pdf");
I got some strange results as follows:-
1.
<?php
$type=system("file -i -b mime.php");
echo $type;
?>
text/plain; charset=us-ascii
text/plain; charset=us-ascii
2.
<?php
$type=system("file -i -b mime.php");
echo $type."<br/>\n";
$split=split(";",$type);
print_r($split);
$type=trim($split[0]);
echo $type;
?>
text/plain; charset=us-ascii
text/plain; charset=us-ascii<br/>
Array
(
[0] => text/plain
[1] => charset=us-ascii
)
text/plain
3.
<?php
$type=@system("file -i -b mime.php");
//echo $type."<br/>\n"; // just comment this line
$split=split(";",$type);
print_r($split);
$type=trim($split[0]);
echo $type;
?>
text/x-c++; charset=us-ascii
Array
(
[0] => text/x-c++
[1] => charset=us-ascii
)
text/x-c++