The 2GB limit is mentioned several times in PHP's contributed notes: http://ru.php.net/manual/en/function.fi ... php#100434
On my current installation I've worked around this using.... but I'm sure there's a better command-line based method for getting the filesize.
Code: Select all
foreach ($results as $result) {
if (file_exists(DIR_DOWNLOAD . $result['filename'])) {
//PREVENT LARGE FILES FROM USING filesize()
if (strstr($result['name'], "Sermon MP3 Downloads")) {
$this->data['downloads'][] = array(
'order_id' => $result['order_id'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'name' => $result['name'],
'remaining' => $result['remaining'],
'size' => ' > 2GB',
'href' => HTTPS_SERVER . 'index.php?route=account/download/download&order_download_id=' . $result['order_download_id']
);
} else {
$size = filesize(DIR_DOWNLOAD . $result['filename']);
$i = 0;
$suffix = array(
'B',
'KB',
'MB',
'GB',
'TB',
'PB',
'EB',
'ZB',
'YB'
);
while (($size / 1024) > 1) {
$size = $size / 1024;
$i++;
}
$this->data['downloads'][] = array(
'order_id' => $result['order_id'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'name' => $result['name'],
'remaining' => $result['remaining'],
'size' => round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i],
'href' => HTTPS_SERVER . 'index.php?route=account/download/download&order_download_id=' . $result['order_download_id']
);
}
}
}