diff options
author | Adrian <adrian@digiworks.fr> | 2013-06-24 15:56:45 +0200 |
---|---|---|
committer | Adrian <adrian@digiworks.fr> | 2013-06-24 15:56:45 +0200 |
commit | f496d13ee26c13b3406d30013206af679bf68922 (patch) | |
tree | 441f8f12ea9bc4e83524ec5faf5d31602eefb893 /system/libraries/Upload.php | |
parent | 5d1cacfeadacb03dc8cb4dcb334a3e18db4fc5d7 (diff) |
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.
Diffstat (limited to 'system/libraries/Upload.php')
-rw-r--r-- | system/libraries/Upload.php | 14 |
1 files changed, 13 insertions, 1 deletions
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 @@ -136,6 +136,13 @@ class CI_Upload { public $file_ext = ''; /** + * Force filename extension to lowercase + * + * @var string + */ + public $file_ext_case = FALSE; + + /** * Upload path * * @var string @@ -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) : ''; } // -------------------------------------------------------------------- |