From 23719ab569c9c8d6b791f65d7861daba3895ddcb Mon Sep 17 00:00:00 2001 From: Hunter Wu Date: Thu, 1 Aug 2013 23:15:13 +0800 Subject: Add windows filename rule as an option for upload files --- system/libraries/Upload.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 85428044d..62eca6fdb 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -142,6 +142,13 @@ class CI_Upload { */ public $file_ext_tolower = FALSE; + /** + * Filename Rule + * + * @var string + */ + public $filename_rule = 'default'; + /** * Upload path * @@ -315,7 +322,8 @@ class CI_Upload { 'detect_mime' => TRUE, 'xss_clean' => FALSE, 'temp_prefix' => 'temp_file_', - 'client_name' => '' + 'client_name' => '', + 'filename_rule' => 'default', ); foreach ($defaults as $key => $val) @@ -472,7 +480,7 @@ class CI_Upload { // Sanitize the file name for security $CI =& get_instance(); - $this->file_name = $CI->security->sanitize_filename($this->file_name); + $this->file_name = $CI->security->sanitize_filename($this->file_name, FALSE, $this->filename_rule); // Truncate the file name if it's too long if ($this->max_filename > 0) -- cgit v1.2.3-24-g4f1b