Follows is now working thanks to Andy;
Global named 'get_file_size'
my $size = $DB->table('Links_Files')->select ( ['File_Size'], { ForeignColName => $_[1], ForeignColKey => $_[0] } )->fetchrow;
$size = $size / 1048576;
return sprintf("%.2f", $size);
}Add to 'Detailed' Template
Change 'attachment_field_name' to the name of the field you wish to find the file size for.
Cheers,
Piers
Global named 'get_file_size'
Code:
sub { my $size = $DB->table('Links_Files')->select ( ['File_Size'], { ForeignColName => $_[1], ForeignColKey => $_[0] } )->fetchrow;
$size = $size / 1048576;
return sprintf("%.2f", $size);
}
Code:
File size: <%get_file_size($ID,'attachment_field_name')%>MbChange 'attachment_field_name' to the name of the field you wish to find the file size for.
Cheers,
Piers