Hi, I want to upload an image from a form in codeigniter but I have 2 problems:
1: I do not know how to put the extension of the original file.
2: I get this error: The upload path does not appear to be valid .
$nombreArchivo = "nombre_archivo";
$config['upload_path'] = base_url('/public/imagenes');
$config['file_name'] = $nombreArchivo . "extension del archivo original";
$config['allowed_types'] = "jpg|jpeg|png";
$config['max_size'] = "50000";
$config['max_width'] = "2000";
$config['max_height'] = "2000";
$this->load->library('upload', $config);
if (!$this->upload->do_upload('imagen')) {
//*** ocurrio un error
$data['uploadError'] = $this->upload->display_errors();
echo $this->upload->display_errors();
die('error');
}else {
$nombreImagen = $data['file_name'];
$consulta=$this->db->query("INSERT INTO 'productos'('nombre', 'imagen') VALUES ('$nombre','$nombreImagen')");