From f496d13ee26c13b3406d30013206af679bf68922 Mon Sep 17 00:00:00 2001 From: Adrian Date: Mon, 24 Jun 2013 15:56:45 +0200 Subject: Add a config var to let the choice of having the lower case on the extensions when uploading. The default value is set to FALSE. --- system/libraries/Upload.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'system/libraries/Upload.php') diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 9c2b45659..14863d69a 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -135,6 +135,13 @@ class CI_Upload { */ public $file_ext = ''; + /** + * Force filename extension to lowercase + * + * @var string + */ + public $file_ext_case = FALSE; + /** * Upload path * @@ -294,6 +301,7 @@ class CI_Upload { 'file_type' => '', 'file_size' => NULL, 'file_ext' => '', + 'file_ext_case' => FALSE, 'upload_path' => '', 'overwrite' => FALSE, 'encrypt_name' => FALSE, @@ -965,7 +973,11 @@ class CI_Upload { public function get_extension($filename) { $x = explode('.', $filename); - return (count($x) !== 1) ? '.'.strtolower(end($x)) : ''; + + if($this->file_ext_case) + return (count($x) !== 1) ? '.'.strtolower(end($x)) : ''; + else + return (count($x) !== 1) ? '.'.end($x) : ''; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b