I'm working with codeigniter and I have a form where I can add a new item.
In this form I have a field where I can upload a image and insert to my database.
All works fine to insert into my database.
My question is, how can I add the image which I have uploaded to my folder?
path: nameofproject/imagens/banner/
Here is my controller:
function novo(){
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('banda', 'Banda', 'required');
$this->form_validation->set_rules('data', 'Data', 'required');
$this->form_validation->set_rules('hora_inicio', 'Hora In�cio', 'required|numeric');
$this->form_validation->set_rules('hora_fim', 'Hora Fim', 'required|numeric');
$this->form_validation->set_rules('morada', 'Morada', 'required');
$this->form_validation->set_rules('preco', 'Pre�o', 'required|numeric');
$this->form_validation->set_rules('aquisao_bilhetes', 'Aquisi��o de Bilhetes', 'required');
$this->form_validation->set_rules('descricao', 'Observações', 'required');
$this->form_validation->set_rules('image', 'Imagem', 'required|[image/jpeg|image/png]|file_path[../../imagens/banner/]');
if ( ! $this->input->post())
{
$this->load->view("concertForm");
}
else
{
$dados=$this->input->post();
$this->load->model("Dados_model");
$results = $this->Dados_model->insere($dados);
}
}