summaryrefslogtreecommitdiffstats
path: root/system/libraries/Upload.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2013-06-28 14:04:57 +0200
committerAndrey Andreev <narf@devilix.net>2013-06-28 14:04:57 +0200
commit58706adfae1f8aea16a3ee43d333991f1daf0484 (patch)
treef410bc72a2cfc3b5e7f11f5c830af1926da85b8f /system/libraries/Upload.php
parentcd9797a210089ea65b4d4b16db051d06188b66ed (diff)
parenteac8b2f1e70e3155ae6bacbc37228a0a647a18be (diff)
Merge pull request #2497 from yazuu/upload
Upload : change the file extension to lower case
Diffstat (limited to 'system/libraries/Upload.php')
-rw-r--r--system/libraries/Upload.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 7c48b4294..5861df584 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_tolower = FALSE;
+
+ /**
* Upload path
*
* @var string
@@ -294,6 +301,7 @@ class CI_Upload {
'file_type' => '',
'file_size' => NULL,
'file_ext' => '',
+ 'file_ext_tolower' => FALSE,
'upload_path' => '',
'overwrite' => FALSE,
'encrypt_name' => FALSE,
@@ -965,7 +973,14 @@ class CI_Upload {
public function get_extension($filename)
{
$x = explode('.', $filename);
- return (count($x) !== 1) ? '.'.end($x) : '';
+
+ if (count($x) === 1)
+ {
+ return '';
+ }
+
+ $ext = ($this->file_ext_tolower) ? strtolower(end($x)) : end($x);
+ return '.'.$ext;
}
// --------------------------------------------------------------------