<?php
// Get the requested file name from the query parameter
$file = isset($_GET['file']) ? $_GET['file'] : '';

// URL of the Nextcloud shared file (assuming you will handle specific files differently)
$nextcloud_base_url = 'https://nextcloud.example.com/s/yoursharelink/download';

// Construct the full URL for the requested file
$nextcloud_url = $nextcloud_base_url . '/' . $file;

// Set headers to force download
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');

// Read and output the file from Nextcloud
readfile($nextcloud_url);
exit;
?>

