Skip to content

Instantly share code, notes, and snippets.

@alpharder
Created August 19, 2015 11:20
Show Gist options
  • Save alpharder/3d45298c84e2671ae6fd to your computer and use it in GitHub Desktop.
Save alpharder/3d45298c84e2671ae6fd to your computer and use it in GitHub Desktop.
diff --git a/app/functions/fn.fs.php b/app/functions/fn.fs.php
index 87d88b7..f28a5fe 100644
--- a/app/functions/fn.fs.php
+++ b/app/functions/fn.fs.php
@@ -308,7 +308,7 @@ function fn_get_file_type($filename, $not_available_result = 'application/octet-
$types = fn_get_ext_mime_types('ext');
- $ext = fn_get_file_ext($filename);
+ $ext = fn_strtolower(fn_get_file_ext($filename));
if (!empty($types[$ext])) {
$file_type = $types[$ext];
@@ -665,12 +665,7 @@ function fn_rm($source, $delete_root = true, $pattern = '')
*/
function fn_get_file_ext($filename)
{
- $i = strrpos($filename, '.');
- if ($i === false) {
- return '';
- }
-
- return substr($filename, $i + 1);
+ return (string)pathinfo($filename, PATHINFO_EXTENSION);
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment