<?php
// Define the directory where the photos are stored
$target_dir = "uploads/";

// Get the filename from the URL parameter
$filename = $_GET['filename'];
$filepath = $target_dir . $filename;

// Check if the file exists
if (file_exists($filepath)) {
    // Set the appropriate headers
    header('Content-Type: ' . mime_content_type($filepath));
    header('Content-Length: ' . filesize($filepath));
    
    // Read the file and output its contents
    readfile($filepath);
    exit;
} else {
    http_response_code(404);
    echo "File not found.";
    exit;
}
?>
