<?php
if (isset($_GET['file'])) {

    // ✅ सुरक्षा (important)
    $file = basename($_GET['file']); 

    // 📂 correct path
    $filePath = "../instructor/lessons_uploads/" . $file;

    if (file_exists($filePath)) {

        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename="' . $file . '"');
        header('Content-Length: ' . filesize($filePath));

        readfile($filePath);
        exit;

    } else {
        echo "File not found!";
    }
}
?>