data() публичный Метод

Returns an associative array containing all of the information related to the upload, allowing the developer easy access in one array.
public data ( string $index = NULL ) : mixed
$index string
Результат mixed
Пример #1
0
 function do_upload($_FILES = '', $field = 'userfile')
 {
     if (empty($_FILES[$field])) {
         $this->set_error('upload_no_file_selected');
         return FALSE;
     } else {
         if (count($_FILES[$field]['name']) > 1) {
             foreach ($_FILES[$field]['name'] as $index => $name) {
                 if (!empty($name)) {
                     $this->do_xupload($_FILES, $field, $index);
                     $temp = parent::data();
                     $this->set_dataArray($temp, $index);
                 }
             }
             return true;
         } else {
             if ($field == 'proimg') {
                 $this->do_xupload($_FILES, $field);
                 $temp = parent::data();
                 $this->set_dataArray($temp, 0);
                 return true;
             } else {
                 parent::do_upload($_FILES, $field);
                 return parent::data();
             }
         }
     }
 }
 /**
  * @param string $file_name
  * @return boolean
  */
 public function upload($file_name)
 {
     $path = $this->_nuevoDirectorio();
     $config = array('upload_path' => $path, 'allowed_types' => 'gif|jpg|png|bmp|doc|docx|pdf|xls|xlsx|txt|ppt|pptx|csv', 'max_size' => '0', 'max_width' => '0', 'max_height' => '0');
     $this->upload = new CI_Upload($config);
     if (!$this->upload->do_upload($file_name)) {
         rmdir($path);
         $this->_error = $this->upload->display_errors();
         return false;
     } else {
         $data = $this->upload->data();
         $relative_path = str_replace(realpath(BASEPATH . "../"), "", realpath($data["full_path"]));
         $relative_path = substr($relative_path, 1, strlen($relative_path));
         $insert = array("arch_c_tamano" => $data["file_size"], "arch_c_nombre" => $relative_path, "arch_c_mime" => $data["file_type"], "arch_c_hash" => $this->_fileHash(), "arch_f_fecha" => DATE("Y-m-d H:i:s"), "usu_ia_id" => $this->session->userdata('session_idUsuario'));
         $this->_archivo_model->query()->insert($insert);
         return true;
     }
 }