Downloads: show size of file?

3 posts by 3 authors in: Forums > CMS Builder
Last Post: October 1, 2010   (RSS)

Re: [videopixel] Downloads: show size of file?

By Jason - September 30, 2010

Hi,

There's a PHP function called filesize:
http://php.net/manual/en/function.filesize.php

This returns the number of bytes in a file. You can determine different unites like this:

EXAMPLE:
$bytes = filesize("file.zip");
$kilobytes = $bytes/1024;
$megabytes = $kilobytes/1024;


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Downloads: show size of file?

By Chris - October 1, 2010

Hi videopixel,

I think what you're after is called a "human readable" file size. Here's an example:

http://www.jonasjohn.de/snippets/php/readable-filesize.htm

I hop this helps! Please let me know if you have any questions.
All the best,
Chris