I wrote this for my message board. It takes a int which is bytes, and makes a string to represent the filesize in a cleaner format, like 1.56 KB or 56 GB. It has a optional
second parameter, bytesstyle, which if set to one will add (n bytes) at the end of the string returned. If for some reason you need values bigger than TB (right now I can't
imagine where) but you can simply copy one of the if ($int >1024+... code and somply replace the value of $str. Other styles can be added easily by copying the if ($str != "
bytes" AND $bytesstyle == 1){$str .= " (".$bytes." bytes)";} snipplet and change the $bytesstyle value. The +256 are for precision. You could also add a negative value and get
returns like 0.95KB. With the setting of positive, you get values such as 1154 MB.