|
@@ -303,18 +303,19 @@ class Core
|
|
|
*/
|
|
|
protected function getExt($filename)
|
|
|
{
|
|
|
- if (!function_exists('finfo_open')) {
|
|
|
- return $this->getExtByByte($filename);
|
|
|
- }
|
|
|
-
|
|
|
if (isset($this->data['file']['type'])) {
|
|
|
$ext = $this->getExtByMine($this->data['file']['type']);
|
|
|
}
|
|
|
- $finfo = finfo_open(FILEINFO_MIME); // 返回 mime 类型
|
|
|
- $code = finfo_file($finfo, $filename);
|
|
|
- finfo_close($finfo);
|
|
|
- $temp = explode(';', $code);
|
|
|
- $ext = $this->getExtByMine($temp[0]);
|
|
|
+ if (function_exists('finfo_open')) {
|
|
|
+ $finfo = finfo_open(FILEINFO_MIME); // 返回 mime 类型
|
|
|
+ $code = finfo_file($finfo, $filename);
|
|
|
+ finfo_close($finfo);
|
|
|
+ $temp = explode(';', $code);
|
|
|
+ $ext = $this->getExtByMine($temp[0]);
|
|
|
+ } else {
|
|
|
+ $ext = $this->getExtByByte($filename);
|
|
|
+ }
|
|
|
+
|
|
|
if (!$ext || $ext == 'txt' || $ext == 'exe') {
|
|
|
if (isset($this->data['file']['type'])) {
|
|
|
$ext = $this->getExtByMine($this->data['file']['type']);
|