Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
defined("BASEPATH") or exit("No direct script access allowed");
class Alumnos extends CI_Controller
public function ponerFotoAlumno()
$config['upload_path'] = './fotos_alumnos/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 2048;
$this->load->library('upload', $config);
if (!$this->upload->do_upload('foto')) { #Aquí me refiero a "foto", el nombre que pusimos en FormData
$error = array('error' => $this->upload->display_errors());
echo json_encode($error);
} else {
echo json_encode(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment