<?php require 'vendor/autoload.php'; $db = Connection::getConnection(); error_reporting(E_ALL); $response = array('data' => array(), 'error' => 0); if (isset($_GET['clasificacion_documento_id']) and isset($_GET['id_maestro'])) { $id = htmlspecialchars($_GET['clasificacion_documento_id']); $id = strip_tags($id); $id = filter_var($id, FILTER_VALIDATE_INT); $id_maestro = htmlspecialchars($_GET['id_maestro']); $id_maestro = strip_tags($id_maestro); $id_maestro = filter_var($id_maestro, FILTER_VALIDATE_INT); $documentos = Documentos::where('clasificacion_documento_id', '=', $id)->where('id_maestro', '=', $id_maestro)->orderBy('Tipo_Documento_Id')->get(); if (count($documentos) > 0) { $clasificacion = ''; switch ($id) { case 1: $clasificacion = '/documentacion/'; break; case 2: $clasificacion = '/alternativa_1/'; break; case 3: $clasificacion = '/alternativa_2/'; break; default: # code... break; } foreach ($documentos as $key => $value) {
<?php require 'vendor/autoload.php'; $db = Connection::getConnection(); error_reporting(E_ALL); if (isset($_GET['id_documento'])) { $id = htmlspecialchars($_GET['id_documento']); $id = strip_tags($id); $id = filter_var($id, FILTER_VALIDATE_INT); $documento = Documentos::where('id', '=', $id)->get(); if (count($documento) > 0) { $pathToFile = __DIR__ . '/uploads/' . $documento[0]->id_maestro . '/'; switch ($documento[0]->Clasificacion_Documento_Id) { case 1: $pathToFile .= 'documentacion/'; break; case 2: $pathToFile .= 'alternativa_1/'; break; case 3: $pathToFile .= 'alternativa_2/'; break; default: # code... break; } $pathToFile .= $documento[0]->Documento; $name = $documento[0]->Documento; if (file_exists($pathToFile)) { header('Content-Descripcion: File Transfer'); header("Content-type: application/octet-stream");