diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php
index 36804051..b180ab34 100644
--- a/admin/admin_ticket.php
+++ b/admin/admin_ticket.php
@@ -1193,9 +1193,9 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
echo '
-
+
- ' . $att_name . '
+ ' . $att_name . ' (' . mfh_getAttachmentFileSize($att_id) . ')' . '
';
}
}
diff --git a/inc/common.inc.php b/inc/common.inc.php
index b6ce26f9..e2821a7e 100644
--- a/inc/common.inc.php
+++ b/inc/common.inc.php
@@ -2131,6 +2131,31 @@ function mfh_getNumberOfDownloadsForAttachment($att_id, $table = 'attachments')
return $rec['download_count'];
}
+function mfh_getAttachmentFileSize($att_id, $table = 'attachments') {
+ global $hesk_settings;
+
+ $res = hesk_dbQuery('SELECT `size` FROM `' . hesk_dbEscape($hesk_settings['db_pfix'] . $table) . "` WHERE `att_id` = " . intval($att_id));
+ $rec = hesk_dbFetchAssoc($res);
+ return human_filesize($rec['size']);
+}
+
+function human_filesize($bytes, $decimals = 2) {
+ global $hesklang;
+
+ $sz = 'BKMGTP';
+ $factor = floor((strlen($bytes) - 1) / 3);
+
+ if ($factor < strlen($sz)) {
+ $factorName = @$sz[$factor];
+ if ($factorName !== 'B') {
+ $factorName .= 'B';
+ }
+
+ return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . ' ' . $factorName;
+ }
+ return $hesklang['unknown'];
+}
+
function mfh_getSettings()
{
global $hesk_settings;
diff --git a/inc/view_attachment_functions.inc.php b/inc/view_attachment_functions.inc.php
index 3aee6e88..df2a45b9 100644
--- a/inc/view_attachment_functions.inc.php
+++ b/inc/view_attachment_functions.inc.php
@@ -24,6 +24,7 @@ function mfh_listAttachments($attachments = '', $reply = 0, $is_staff)
if ($is_staff) {
echo '