diff --git a/tinyfilemanager.php b/tinyfilemanager.php
index 81da548..3092774 100644
--- a/tinyfilemanager.php
+++ b/tinyfilemanager.php
@@ -938,6 +938,22 @@ if (isset($_GET['dl'], $_POST['token'])) {
// Call the download function
fm_download_file($path . '/' . $dl, $dl, 1024); // Download with a buffer size of 1024 bytes
exit;
+ } else if ($dl != '' && is_dir($path . '/' . $dl)) {
+ chdir($path);
+
+ // zip the directory
+ $zipname = sys_get_temp_dir() .'/'. $dl;
+ $zipper = new FM_Zipper();
+ $res = $zipper->create($zipname, $dl);
+
+ if ($res) {
+ // download the zip file and delete it afterwards
+ fm_download_file($zipname, $dl . '.zip', 1024);
+ unlink($zipname);
+ } else {
+ fm_set_msg(lng('Error while creating Archive'), 'error');
+ }
+ exit;
} else {
// Handle the case where the file is not found
fm_set_msg(lng('File not found'), 'error');
@@ -2218,6 +2234,7 @@ $all_files_size = 0;
+