30 lines
697 B
PHP
30 lines
697 B
PHP
<?php
|
|
error_reporting(0);
|
|
include "../includes/config/config.php";
|
|
include "functions.php";
|
|
include 'log_entry.php';
|
|
|
|
if (isset($_REQUEST['emp_id'])) {
|
|
$id = mysqli_real_escape_string($conn, $_REQUEST['emp_id']);
|
|
|
|
$sql = "SELECT * FROM employee_docs WHERE emp_id = $emp_id";
|
|
|
|
error_log("doc query " . $sql);
|
|
|
|
$result = $conn->query($sql);
|
|
|
|
if ($result->num_rows > 0) {
|
|
$row = $result->fetch_assoc();
|
|
|
|
header('Content-Type: application/octet-stream');
|
|
header('Content-Disposition: attachment; filename="' . $row['doc_type'] . '"');
|
|
|
|
|
|
ob_clean();
|
|
echo $row['document'];
|
|
die;
|
|
} else {
|
|
echo "Document not found";
|
|
}
|
|
}
|