+ $mte = new \MIME_Type_Extension();
+ $mimetype = $mte->getMIMEType($filePath);
+ $media = \MIME_Type::getMedia($mimetype);
+ if (!isset($urlList[$media])) {
+ Log::err('File type not allowed: ' . $mimetype);
+ exit(20);
+ }
+ $urlList[$media][] = $filePath;
+ } else if (file_exists($filePath)) {
+ //file
+ $mimetype = \MIME_Type::autoDetect($filePath);
+ $media = \MIME_Type::getMedia($mimetype);
+ if (!isset($urlList[$media])) {
+ Log::err('File type not allowed: ' . $mimetype);
+ exit(20);
+ }
+ $fileList[$media][] = $filePath;