note 78841 deleted from ref.fileinfo by mazzanet
| From: | mazzanet@php.net | Date: | Tue, 26 Apr 2011 09:44:11 +0000 |
| Subject: | note 78841 deleted from ref.fileinfo by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179144@lists.php.net to get a copy of this message | ||
Note Submitter: DanielWalker at ncfe dot org dot uk
----
Using the Unix 'file' program with the -i switch will not work reliably.
Consider the following plain-text CSV file (we'll call it 'error.csv'), which has the
contents:
GIFT,WRAPPED,ERRORS,ON,LOOKING,At,FILES
...just that one line: nothing above it, nothing below.
Now, what does asking:
file -i error.csv
...give us for this file? Yes, that's right -
'error.csv: image/gif'
Why? Because the first line starts 'GIF...', that's why. You cannot trust file.