<?php

// Define the file path
$filename = 'contactlist.rtf';
$filePath = __DIR__ . '/' . $filename;

// Check if file exists and is readable
if (!file_exists($filePath) || !is_readable($filePath)) {
    http_response_code(404);
    echo "Error: File not found or not accessible.";
    exit;
}

// Set appropriate headers
header('Content-Type: application/rtf');
header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
header('Content-Length: ' . filesize($filePath));

// Output the file content
readfile($filePath);
exit;
?>
