$renderMain = new TemplateEngine(); $renderSubirApunte = new TemplateEngine(); $usuarios = new Usuario($db); $usuario = $usuarios->findBy('user_name', $_SESSION['name']); $renderSubirApunte->materias = $usuario[0]->materias(); //se renderiza el combobox materia $renderSubirApunte->modal = null; //FUNCIONES DEL CONTROLADOR $renderMain->title = "SubirApunte"; //Titulo y cabecera de la pagina if (isset($_FILES['apunteUploaded'])) { //inicio colecta de datos para ser introducidos en la bd $apunte = new Apunte($db); $id = $usuario[0]->getUser_id(); $apunte->setUser_id($id); $apunte->setApunte_name($_POST['name']); $apunte->setMat_id($_POST['materia']); $apunte->setAnho_academico($_POST['anho']); //fin colecta de datos //inicio operacion subir archivo $titulo = "Archivo subido correctamente"; $contenido = "gracias por su colaboración con la comunidad"; $target = "../apuntes/"; $hashedName = md5_file($_FILES['apunteUploaded']['tmp_name']); //en el servidor su guarda como filename el hash md5 //resultante de hashear el archivo. Asi si dos archivos son diferentes tendran diferente filename $target = $target . basename($hashedName); $ok = 1; if ($_FILES["apunteUploaded"]["type"] == "application/pdf") { if (is_uploaded_file($_FILES['apunteUploaded']['tmp_name'])) { if (move_uploaded_file($_FILES['apunteUploaded']['tmp_name'], $target)) {