Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tinyfilemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,22 @@ function get_file_path()
// 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');
Expand Down Expand Up @@ -2208,6 +2224,7 @@ class="edit-file"><i class="fa fa-pencil-square"></i> <?php echo lng('AdvancedEd
<a title="<?php echo lng('CopyTo') ?>..." href="?p=&amp;copy=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="fa fa-files-o" aria-hidden="true"></i></a>
<?php endif; ?>
<a title="<?php echo lng('DirectLink') ?>" href="<?php echo fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f . '/') ?>" target="_blank"><i class="fa fa-link" aria-hidden="true"></i></a>
<a title="<?php echo lng('Download') ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;dl=<?php echo urlencode($f) ?>" onclick="confirmDailog(event, 1211, '<?php echo lng('Download'); ?>','<?php echo urlencode($f); ?>', this.href);"><i class="fa fa-download"></i></a>
</td>
</tr>
<?php
Expand Down