Browse code

Created repository.

DoubleBastionAdmin authored on 26/01/2022 20:32:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,40 @@
1
+<?php
2
+/**
3
+ *  Copyright (C) 2021  Double Bastion LLC
4
+ *
5
+ *  This file is part of Roundpin, which is licensed under the
6
+ *  GNU Affero General Public License Version 3.0. The license terms
7
+ *  are detailed in the "LICENSE.txt" file located in the root directory.
8
+ */
9
+
10
+session_start();
11
+
12
+if (isset($_GET['s_ajax_call']) && ($_GET['s_ajax_call'] == $_SESSION['validate_s_access']) && isset($_GET['recSipUser']) &&
13
+    $_GET['recSipUser'] != '' && isset($_GET['recFlNm']) && $_GET['recFlNm'] != '') {
14
+
15
+    $recSipUser = $_GET['recSipUser'];
16
+    $recFileName = $_GET['recFlNm'];
17
+    $fileToDownload = 'textchat/' . $recSipUser . '/uploads/' . $recFileName;
18
+
19
+    // Process the download
20
+    if (is_file($fileToDownload)) {
21
+            header('Content-Description: File Transfer');
22
+            header('Content-Type: application/octet-stream');
23
+            header('Content-Disposition: attachment; filename="' . basename($fileToDownload) . '"');
24
+            header('Expires: 0');
25
+            header('Cache-Control: no-cache, must-revalidate');
26
+            header('Pragma: public');
27
+            header('Content-Length: ' . filesize($fileToDownload));
28
+            flush();
29
+            readfile($fileToDownload);
30
+            exit();
31
+    } else {
32
+            http_response_code(404);
33
+	    exit();
34
+    }
35
+
36
+} else {
37
+        header("Location: roundpin-login.php");
38
+}
39
+
40
+?>