summaryrefslogtreecommitdiffstats
path: root/system/libraries/Upload.php
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2009-02-16 14:51:42 +0100
committerDerek Allard <derek.allard@ellislab.com>2009-02-16 14:51:42 +0100
commitd70b064ca3d38115ec53c38528fe7c02a9ddcf97 (patch)
treec19c55a2a0797226ebd277f82781957e060fa922 /system/libraries/Upload.php
parent70d835456214cf26d1b09cfa250a6fcb44910368 (diff)
changes to allow file name changing in upload, extension preserved
Diffstat (limited to 'system/libraries/Upload.php')
-rw-r--r--system/libraries/Upload.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 92bf6912b..6309caee3 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -187,7 +187,7 @@ class CI_Upload {
// Set the uploaded data as class variables
$this->file_temp = $_FILES[$field]['tmp_name'];
- $this->file_name = ($this->file_name != '') ? $this->_prep_filename($this->file_name) : $this->_prep_filename($_FILES[$field]['name']);
+ $this->file_name = $this->_prep_filename($_FILES[$field]['name'];
$this->file_size = $_FILES[$field]['size'];
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
$this->file_type = strtolower($this->file_type);
@@ -927,7 +927,13 @@ class CI_Upload {
$filename .= '.'.$part;
}
}
-
+
+ // file name override
+ if ($this->file_name != '')
+ {
+ $filename = $this->file_name;
+ }
+
$filename .= '.'.$ext;
return $filename;