Created
April 20, 2018 22:19
-
-
Save parzibyte/183a0a4ba62288f8ca42acaac437bb2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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