diff --git a/include/class.file.php b/include/class.file.php index 15f4ea17a0f8dc294672bfa4d695a7a12dc1ff09..b38ddb2dc6e895642403a394a21d632223b454cc 100644 --- a/include/class.file.php +++ b/include/class.file.php @@ -331,7 +331,7 @@ class AttachmentFile { return false; } - if (!$file['type']) { + if (!$file['type'] && extension_loaded('fileinfo')) { $finfo = new finfo(FILEINFO_MIME_TYPE); if ($file['data']) $type = $finfo->buffer($file['data']); @@ -340,9 +340,9 @@ class AttachmentFile { if ($type) $file['type'] = $type; - else - $file['type'] = 'application/octet-stream'; } + if (!$file['type']) + $file['type'] = 'application/octet-stream'; $sql='INSERT INTO '.FILE_TABLE.' SET created=NOW() ' .',type='.db_input(strtolower($file['type'])) diff --git a/include/staff/system.inc.php b/include/staff/system.inc.php index 4238e3dbeced405a5662c96a01598aa9764086e6..1445f25474e541c5354da7bffaf0f75e57a99010 100644 --- a/include/staff/system.inc.php +++ b/include/staff/system.inc.php @@ -33,6 +33,10 @@ $extensions = array( 'name' => 'phar', 'desc' => __('Highly recommended for plugins and language packs') ), + 'fileinfo' => array( + 'name' => 'fileinfo', + 'desc' => __('Used to detect file types for uploads') + ), ); ?>