forked from baelmyhu/Test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile02.php
More file actions
29 lines (23 loc) · 769 Bytes
/
file02.php
File metadata and controls
29 lines (23 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/*
* Method for identify Internet media type
* @param $filename
*/
function typeMime($filename)
{
if (preg_match("@Opera(/| )([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)) {
$navigateur = "Opera";
} elseif (preg_match("@MSIE ([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)) {
$navigateur = "Internet Explorer";
} else {
$navigateur = "Mozilla";
$mime = parse_ini_file("mime.ini");
$extension = substr($filename, strrpos($filename, ".") + 1);
}
if (array_key_exists($extension, $mime)) {
$type = $mime[$extension];
} else {
$type = ($navigateur != "Mozilla") ? 'application/octetstream' : 'application/octet-stream';
}
return $type;
}