summaryrefslogtreecommitdiffstats
path: root/system/libraries/Upload.php
diff options
context:
space:
mode:
authorMichiel Vugteveen <michiel@it-can.nl>2012-06-11 09:17:14 +0200
committerMichiel Vugteveen <michiel@it-can.nl>2012-06-11 09:17:14 +0200
commitdca9f23d2d24ccf412d239693d2d156a8ee7fabe (patch)
treee85a42ae8b0816e4860097385d918c9bfa170e11 /system/libraries/Upload.php
parent4db16326a0418776f10802ecdcccb385ff67e363 (diff)
get upload data with index key
Diffstat (limited to 'system/libraries/Upload.php')
-rw-r--r--system/libraries/Upload.php30
1 files changed, 19 insertions, 11 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 1f6aeeb6b..e422edb6c 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -347,26 +347,34 @@ class CI_Upload {
* Returns an associative array containing all of the information
* related to the upload, allowing the developer easy access in one array.
*
+ * @param string
* @return array
*/
- public function data()
+ public function data($index = NULL)
{
- return array(
- 'file_name' => $this->file_name,
- 'file_type' => $this->file_type,
- 'file_path' => $this->upload_path,
- 'full_path' => $this->upload_path.$this->file_name,
- 'raw_name' => str_replace($this->file_ext, '', $this->file_name),
- 'orig_name' => $this->orig_name,
+ $data = array(
+ 'file_name' => $this->file_name,
+ 'file_type' => $this->file_type,
+ 'file_path' => $this->upload_path,
+ 'full_path' => $this->upload_path.$this->file_name,
+ 'raw_name' => str_replace($this->file_ext, '', $this->file_name),
+ 'orig_name' => $this->orig_name,
'client_name' => $this->client_name,
- 'file_ext' => $this->file_ext,
- 'file_size' => $this->file_size,
- 'is_image' => $this->is_image(),
+ 'file_ext' => $this->file_ext,
+ 'file_size' => $this->file_size,
+ 'is_image' => $this->is_image(),
'image_width' => $this->image_width,
'image_height' => $this->image_height,
'image_type' => $this->image_type,
'image_size_str' => $this->image_size_str,
);
+
+ if ($index === NULL OR ! isset($data[$index]))
+ {
+ return $data;
+ }
+
+ return $data[$index];
}
// --------------------------------------------------------------------