diff options
Diffstat (limited to 'system/libraries/Upload.php')
-rwxr-xr-x | system/libraries/Upload.php | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 8f84ffd7e..e80049fa4 100755 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -142,7 +142,8 @@ class CI_Upload { */ public function do_upload($field = 'userfile') { - // Is $_FILES[$field] set? If not, no reason to continue. + + // Is $_FILES[$field] set? If not, no reason to continue. if ( ! isset($_FILES[$field])) { $this->set_error('upload_no_file_selected'); @@ -214,7 +215,7 @@ class CI_Upload { $this->file_name = $this->_prep_filename($this->_file_name_override); // If no extension was provided in the file_name config item, use the uploaded one - if(strpos($this->_file_name_override, '.') === FALSE) + if (strpos($this->_file_name_override, '.') === FALSE) { $this->file_name .= $this->file_ext; } @@ -874,12 +875,6 @@ class CI_Upload { } $CI =& get_instance(); - - if ( ! isset($CI->security)) - { - $CI->load->library('security'); - } - return $CI->security->xss_clean($data, TRUE); } @@ -950,11 +945,21 @@ class CI_Upload { if (count($this->mimes) == 0) { - if (@require_once(APPPATH.'config/mimes'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) + { + include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT); + } + elseif (is_file(APPPATH.'config/mimes'.EXT)) + { + include(APPPATH.'config//mimes'.EXT); + } + else { - $this->mimes = $mimes; - unset($mimes); + return FALSE; } + + $this->mimes = $mimes; + unset($mimes); } return ( ! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime]; |