myPortal CMS - the web design community
  • MyPortal 2.0
  • download
  • demo
  • manual
  • editor
  • faq
  • blog
  • forum

free account: Click here
Username: Password:

Manual

file functions

sizefile($size)

format bytes to human readable file size

echo sizefile(1024);
// 1 Kb

directorysize($dir)

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

echo directorysize('cache');
// 100345

get_file_type($file)

return content type of file specified by filename

echo get_file_type('file.zip');
// application/zip
echo get_file_type('image.jpg');
// image/jpeg

filedownload($filename,$pathtofile,$content='attachment')

// offers download
filedownload('file.txt','/tmp/file.log');
 
// open file to the browser
filedownload('file.txt','/tmp/file.log','inline');

Try myPortal 2: