Manual

file functions

sizefile($size) {#sizefile}

format bytes to human readable file size

{{lang:php}}
echo sizefile(1024);
// 1 Kb

directorysize($dir) {#directorysize}

return size of direcory not recursively it may be slow if direcotry contains lots of files

{{lang:php}}
echo directorysize('cache');
// 100345

getfiletype($file) {#getfiletype}

return content type of file specified by filename

{{lang:php}}
echo get_file_type('file.zip');
// application/zip
echo get_file_type('image.jpg');
// image/jpeg

filedownload($filename,$pathtofile,$content='attachment') {#filedownload}

{{lang:php}}
// offers download
filedownload('file.txt','/tmp/file.log');

// open file to the browser
filedownload('file.txt','/tmp/file.log','inline');
Try myPortal 2: