[eluser]Unknown[/eluser]
It was coding and realized that when I used
$this->load->initializate('upload', $config); in a role he
callback__do_upload instantiated model I carried the autoload.
My autoload config:
Code:
$autoload['model'] = array('m_galerias', 'm_parceiros');
My controller code:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class GD_Categorias extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function imgs($act = NULL, $cid = NULL, $img_id = NULL)
{
$data['act'] = $act ? $act : NULL;
$data['cid'] = $cid ? $cid : NULL;
$data['img_id'] = $img_id ? $img_id : NULL;
if ( ! $cid)
{
redirect(site_url('admin/gd_categorias'), 'location');
}
foreach($this->m_galerias->pega_dados_categoria(urlsafe_b64decode($cid)) as $linha)
{
$data['categoria'] = $linha->categoria;
}
if ($act == 'add')
{
$this->load->helper('form');
$this->load->library(array('form_validation', 'upload'));
$this->form_validation->set_error_delimiters('<div class="error"><span>', '</span></div>');
$this->form_validation->set_rules('userfile', '<strong>Imagem</strong>', 'callback__do_upload');
if ($this->form_validation->run() === FALSE)
{
$output['content'] = $this->load->view('admin/gd_imagens_form', $data, TRUE);
}
else
{
$upd_data = $this->upload->data();
$bd['gc_id'] = urlsafe_b64decode($cid);
$bd['imagem'] = $upd_data['file_name'];
$bd['data'] = date('Y-m-d H:i:s');
$this->m_galerias->add_img($bd);
redirect('admin/gd_categorias/imgs/view/'.$cid, 'location');
}
$this->load->view('layouts/admin', $output);
}
}
public function _do_upload()
{
$config['upload_path'] = 'imgs/galerias/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '1024';
$config['max_width'] = '1300';
$config['max_height'] = '1000';
$config['encrypt_name'] = TRUE;
$this->load->initialize('upload', $config);
if ( ! $this->upload->do_upload())
{
return FALSE;
}
else
{
return TRUE;
}
}
}
When I press the button to send the following error:
Quote:The model name you are loading is the name of a resource that is already being used: m_galerias
In the other files there is no loading model with this name!
It is an issue in ci or mine?
Sorry for the English is that I am Brazilian and thank you.