public function guardarImagen($object){
$directorio = IMG_PATH.'/'.$object->directorio.'/';
$nombre_imagen = $object->nombre_imagen;
$ext = $object->ext;
$field_name = $object->field_name;
$config['upload_path'] = $directorio;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '15000';
$config['encrypt_name'] = FALSE;
$config['overwrite'] = FALSE;
$config['file_name'] = $nombre_imagen.'.'.$ext;
$this->load->library('upload');
$this->upload->initialize($config);
$data = array();
if(!$this->upload->do_upload($field_name)){
$this->upload->display_errors();
}else{
$data = $this->upload->data();
}
return $data;
}
No hay comentarios:
Publicar un comentario