diff options
author | admin <devnull@localhost> | 2006-09-21 17:30:56 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-09-21 17:30:56 +0200 |
commit | bc4fffbc55d7d04a98a50f1aefa414f965d90644 (patch) | |
tree | 429c94f5a8687c18909751faddae948310e1b58c | |
parent | abc049ea54fab5206c6cc4c679e02b96f5a5201e (diff) |
-rw-r--r-- | system/libraries/Upload.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 6d12dbcd7..98edd654f 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -98,10 +98,10 @@ class CI_Upload { * @access public * @return bool */ - function do_upload() + function do_upload($field = 'userfile') { - // Is $_FILES['userfile'] set? If not, no reason to continue. - if ( ! isset($_FILES['userfile'])) + // Is $_FILES[$field] set? If not, no reason to continue. + if ( ! isset($_FILES[$field])) { $this->set_error('upload_userfile_not_set'); return FALSE; @@ -114,9 +114,9 @@ class CI_Upload { } // Was the file able to be uploaded? If not, determine the reason why. - if ( ! is_uploaded_file($_FILES['userfile']['tmp_name'])) + if ( ! is_uploaded_file($_FILES[$field]['tmp_name'])) { - $error = ( ! isset($_FILES['userfile']['error'])) ? 4 : $_FILES['userfile']['error']; + $error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; switch($error) { @@ -134,12 +134,12 @@ class CI_Upload { } // Set the uploaded data as class variables - $this->file_temp = $_FILES['userfile']['tmp_name']; - $this->file_name = $_FILES['userfile']['name']; - $this->file_size = $_FILES['userfile']['size']; - $this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES['userfile']['type']); + $this->file_temp = $_FILES[$field]['tmp_name']; + $this->file_name = $_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); - $this->file_ext = $this->get_extension($_FILES['userfile']['name']); + $this->file_ext = $this->get_extension($_FILES[$field]['name']); // Convert the file size to kilobytes if ($this->file_size > 0) |