Issue
I made a formulary with 2 diferents uploads and diferents rules (one for image and one for archive), the image upload works, but when goes to archive the rules dont overwrite (continues with the rules of the image).
I tried to load the library on construct, dont work.
The function of Image Upload:
$configImagem['upload_path'] = './files/noticias/imagens';
$configImagem['allowed_types'] = 'gif|jpg|jpeg|png';
$configImagem['file_name'] = 'Img_noticia_'.date('y-m-d_h-i-s');
$this->load->library('upload',$configImagem);
$check = $this->upload->do_upload('imagem');
if($check == TRUE){
return TRUE;
} else if($check == FALSE){
$this->session->set_flashdata('erro', '<strong>Erro:</strong>'.$this->upload->display_errors());
return FALSE;
}
}
public function upArquivo(){
$configArq['upload_path'] = './files/noticias/arquivos';
$configImagem['allowed_types'] = 'pdf|txt|doc';
$configArq['file_name'] = 'Arq_noticia_'.date('y-m-d_h-i-s');
$this->load->library('upload',$configArq);
$this->upload->initialize($configArq);
$checkArq = $this->upload->do_upload('arquivo');
if($checkArq == TRUE){
return TRUE;
} else if($checkArq == FALSE){
$this->session->set_flashdata('erro', '<strong>Erro:</strong>'.$this->upload->display_errors());
return FALSE;
}
}
Solution
The variable $configImagem
has to be $configArq
.
Answered By - Marcos Neto
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.