Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 20, 2018 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/183a0a4ba62288f8ca42acaac437bb2a to your computer and use it in GitHub Desktop.
Save parzibyte/183a0a4ba62288f8ca42acaac437bb2a to your computer and use it in GitHub Desktop.
<?php
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