<?php /** * Copyright (C) 2021 Double Bastion LLC * * This file is part of Roundpin, which is licensed under the * GNU Affero General Public License Version 3.0. The license terms * are detailed in the "LICENSE.txt" file located in the root directory. */ session_start(); if (isset($_GET['s_ajax_call']) && ($_GET['s_ajax_call'] == $_SESSION['validate_s_access']) && isset($_GET['recSipUser']) && $_GET['recSipUser'] != '' && isset($_GET['recFlNm']) && $_GET['recFlNm'] != '') { $recSipUser = $_GET['recSipUser']; $recFileName = $_GET['recFlNm']; $fileToDownload = 'textchat/' . $recSipUser . '/uploads/' . $recFileName; // Process the download if (is_file($fileToDownload)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($fileToDownload) . '"'); header('Expires: 0'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($fileToDownload)); flush(); readfile($fileToDownload); exit(); } else { http_response_code(404); exit(); } } else { header("Location: roundpin-login.php"); } ?>