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['destSipUser']) && |
|
13 |
+ $_GET['destSipUser'] != '' && isset($_GET['sentFlNm']) && $_GET['sentFlNm'] != '') { |
|
14 |
+ |
|
15 |
+ $destSipUser = $_GET['destSipUser']; |
|
16 |
+ $sentFileName = $_GET['sentFlNm']; |
|
17 |
+ $fileToDownload = 'textchat/' . $destSipUser . '/uploads/' . $sentFileName; |
|
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 |
+?> |