/**
* @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;
}
}