PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
gotDNS
Forum Contributor
Posts: 217 Joined: Tue May 07, 2002 5:53 pm
Location: West Chester, PA
Post
by gotDNS » Sat May 18, 2002 9:53 pm
Hey, how do i use filesize() so that it only shows the file size out to 2 decimal places? PHP.net seems to be down, so anyone that can help, thanks!
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sat May 18, 2002 10:07 pm
$f_size1 = filesize($file_name);
$f_size2 = substr($f_size1, 0, 4);
might work... and $f_size2 would be the filesize only to two decimal places...
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sat May 18, 2002 10:15 pm
sorry, that was totally wrong
$size = filesize($filename);
$size = ($size/1000);
$size = round($size,2);
will put it in KB, rounding to 2 decimal places
sam
Forum Contributor
Posts: 217 Joined: Thu Apr 18, 2002 11:11 pm
Location: Northern California
Contact:
Post
by sam » Sun May 19, 2002 12:39 pm