diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2010-12-15 11:45:06 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2010-12-15 11:45:06 +0100 |
commit | 1e74da235f7739e3d9b5e1f84cda6313499cefa1 (patch) | |
tree | a205f4f2eba7529f24b8c0024b9ecef0b9e98125 /system/libraries/Upload.php | |
parent | a58ecae8e149fe8e1fa9ee3cc9c9ad23a67ab8b6 (diff) |
Upload library file_name can now be set without an extension, the extension will be taken from the uploaded file instead of the given name.
Diffstat (limited to 'system/libraries/Upload.php')
-rw-r--r-- | system/libraries/Upload.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 4ccbdde90..b0e1f4c6c 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -212,7 +212,18 @@ class CI_Upload { if ($this->_file_name_override != '') { $this->file_name = $this->_prep_filename($this->_file_name_override); - $this->file_ext = $this->get_extension($this->file_name); + + // If no extension was provided in the file_name config item, use the uploaded one + if(strpos($this->_file_name_override, '.') === FALSE) + { + $this->file_name .= $this->file_ext; + } + + // An extension was provided, lets have it! + else + { + $this->file_ext = $this->get_extension($this->_file_name_override); + } if ( ! $this->is_allowed_filetype(TRUE)) { |