hola expertos tengo un pequeño problema estoy un mant CRUD con ajax js bootstrap en codeigniter
me guadar todos los datos y la imagen solo guarda la que esta en condicional que es default.png, al parece que no captura la variable lo llamo desde un formulario tipo modal bootstrap quizas sea por esop eh buscado ejemplos pero en la red no hay ninguno sobre este tema por eso recurro a su experiencia
esta es la vista de mi controlador y mi vista
--------------------controller person
public function ajax_add()
{
$this->_validate();
$config['upload_path'] = './imagenes/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 1000;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$config['encrypt_name'] =TRUE;
$this->load->library('upload', $config);
$this->upload->do_upload('imagenes');
$data = $this->upload->data();
/*var_dump($data);
die();*/
$imagenes=$data['file_name'];
if (empty($imagenes)) {
$imagenes="default.jpg";
}
$data = array(
'firstName' => $this->input->post('firstName'),
'lastName' => $this->input->post('lastName'),
'gender' => $this->input->post('gender'),
'address' => $this->input->post('address'),
'dob' => $this->input->post('dob'),
'codist' => $this->input->post('codist'),
'codcargo' => $this->input->post('codcargo'),
'imagen' => $imagenes,
);
$insert = $this->person->save($data);
echo json_encode(array("status" => TRUE));
}
---------------------------person_view.php
<div class="modal fade" id="modal_form" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h3 class="modal-title">Person Form</h3>
</div>
<div class="modal-body form" role="form">
<form action="#" method="POST" id="form" class="form-horizontal" enctype="multipart/form-data">
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload-preview thumbnail" data-trigger="fileupload" style="width: 100px; height: 100px;"></div>
<div>
<span class="btn btn-default btn-file"><span class="fileupload-new">Select image</span><span class="fileupload-exists">Change</span>
<input type="file" id="imagenes" name="imagenes">
<input type="hidden" class="form-control" id="OLD_IMG" name="OLD_IMG" >
</span>
<a href="#" id="re_image" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>