xxxxxxxxxx
<?php
// Get the file name from the URL
$fileName = $_GET['fileName'];
// Connect to the database
$db = new PDO('mysql:host=localhost;dbname=mydb', 'root', '');
// Get the file path from the database
$sql = "SELECT filepath FROM files WHERE filename='$fileName'";
$result = $db->query($sql);
$row = $result->fetch();
$filePath = $row['filepath'];
// Download the file
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
header('Content-Length: ' . filesize($filePath));
readfile($filePath);
?>