17 'txt' =>
'text/plain',
19 'html' =>
'text/html',
22 'js' =>
'application/javascript',
23 'json' =>
'application/json',
24 'xml' =>
'application/xml',
25 'swf' =>
'application/x-shockwave-flash',
26 'flv' =>
'video/x-flv',
30 'jpe' =>
'image/jpeg',
31 'jpeg' =>
'image/jpeg',
32 'jpg' =>
'image/jpeg',
35 'ico' =>
'image/vnd.microsoft.icon',
36 'tiff' =>
'image/tiff',
37 'tif' =>
'image/tiff',
38 'svg' =>
'image/svg+xml',
39 'svgz' =>
'image/svg+xml',
42 'zip' =>
'application/zip',
43 'rar' =>
'application/x-rar-compressed',
44 'exe' =>
'application/x-msdownload',
45 'msi' =>
'application/x-msdownload',
46 'cab' =>
'application/vnd.ms-cab-compressed',
49 'mp3' =>
'audio/mpeg',
50 'qt' =>
'video/quicktime',
51 'mov' =>
'video/quicktime',
54 'pdf' =>
'application/pdf',
55 'psd' =>
'image/vnd.adobe.photoshop',
56 'ai' =>
'application/postscript',
57 'eps' =>
'application/postscript',
58 'ps' =>
'application/postscript',
66 private $defineByExtensionList = [
67 'txt' =>
'text/plain',
69 'html' =>
'text/html',
72 'js' =>
'application/javascript',
73 'json' =>
'application/json',
74 'xml' =>
'application/xml',
75 'svg' =>
'image/svg+xml',
87 if (!file_exists($file)) {
88 throw new \InvalidArgumentException(
"File '$file' doesn't exist");
95 $result = $this->getNativeMimeType($file);
101 $result =
'application/octet-stream';
114 private function getNativeMimeType(
string $file): string
119 && (strpos(
$result,
'text/') === 0 || strpos(
$result,
'image/svg') === 0)
133 private function getFileExtension(
string $file): string
135 return strtolower(pathinfo($file, PATHINFO_EXTENSION));
elseif(isset( $params[ 'redirect_parent']))