function updateFoto() { $cFiles = new cFiles(); $participante = new participantesModel(); $img_anterior = $_POST['img_anterior']; $result = $cFiles->setFile("archivo", "./public/imgParticipantes", false); if ($result == 1) { $res = $participante->updateFoto($_POST['id_participante'], $cFiles->getName()); if ($res) { if ($img_anterior != "sin_imagen_participante.jpg") { $cFiles->deleteFile($img_anterior, "./public/imgParticipantes"); } } header("Location:" . PATH_SITE . 'perfil/'); } }