<?php
session_start();
if (!isset($_SESSION["user_id"])) {
header('Location: /index.php');
exit;
}
$file = basename($_GET['file']);
$filePath = __DIR__ . '/uploadfile/'. $file;
echo $filePath;
if (file_exists($filePath)) {
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . $file . '"');
readfile($filePath);
exit;
} else {
echo "File not found.";
}
?>