diff --git a/filemanager.php b/filemanager.php
index 6687bf0..d736bf1 100644
--- a/filemanager.php
+++ b/filemanager.php
@@ -363,6 +363,52 @@
}
}
+// Download
+if (isset($_GET['dlz'])) {
+ $dl = $_GET['dlz'];
+ $dl = fm_clean_path($dl);
+ $dl = str_replace('/', '', $dl);
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+
+ if (!class_exists('ZipArchive')) {
+ fm_set_msg('Operations with archives are not available', 'error');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+
+ if ($dl != '' && file_exists($path . '/' . $dl)) {
+ chdir($path);
+ $fileName = basename($dl);
+ $zipname = $fileName . '.zip';
+
+ $zipper = new FM_Zipper();
+ $res = $zipper->create($zipname, [$dl]);
+
+ if (!$res) {
+ fm_set_msg('Archive not created', 'error');
+ }else {
+ header('Content-Description: File Transfer');
+ header('Content-Type: application/octet-stream');
+ header('Content-Disposition: attachment; filename="' . basename($zipname) . '"');
+ header('Content-Transfer-Encoding: binary');
+ header('Connection: Keep-Alive');
+ header('Expires: 0');
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+ header('Pragma: public');
+ header('Content-Length: ' . filesize($zipname));
+ readfile($zipname);
+ unlink($zipname);
+ exit;
+ }
+ } else {
+ fm_set_msg('File not found', 'error');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+}
+
+
// Upload
if (isset($_POST['upl'])) {
$path = FM_ROOT_PATH;
@@ -997,6 +1043,7 @@
+