git.cweiske.de
/
MIME_Type_PlainDetect.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
initial commit: mime detection for programming files
[MIME_Type_PlainDetect.git]
/
tests
/
files
/
php
/
file
1
<?php
2
if ($argc !== 2) {
3
echo "Please pass one and only one filename\n";
4
exit(1);
5
}
6
$file = $argv[1];
7
if (!is_readable($file)) {
8
echo "File does not exist or is not readable\n";
9
exit(2);
10
}
11
12
require_once 'MIME/Type.php';
13
echo MIME_Type::autoDetect($file) . "\n";
14
?>