Your Ad Here

 Navigation

Home
Source code
Tutorials
RSS feeds
Articles
Books
Software
Downloads
Hosting
manuals
Forums
Script directory
Training
Our Links

 Sponsors
 Links
finance products
software directory
gambling sites
 Downloads
 Misc

Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming


File size function

File size function

<?php
function file_size($file)
{
//store the actual size of the file
$size = filesize($file);
if($size >= 1073741824)
{
$size = round($size / 1073741824) . " gigabytes ";
}
elseif($size >= 1048756)
{
$size = round($size / 1048576) . " megabytes ";
}
elseif($size >= 1024)
{
$size = round($size / 1024) . " kilobytes ";
}
else
{
$size = $size . " bytes ";
}
return $size;
}
?>

Now lets test this function out with the following .

<?php
echo "index page is " . file_size("index.htm");
echo "<br>";
echo "this page is " . file_size("filesize.php");
?>







Books
 Sponsors
 Random Code
create a date(date/time)

What type of image(image)

Graph(image)

 Random Article
  Network

Programming resources
Tutorials directory
General bid directory
sell software, make money
Find me wholesalers
Find me dropshippers
Free recipes online/a>
UK products and price comparison
Anime videos
Free lyrics search
free stuff
UK stores
Gambling directory
Sexy free wallpapers
Hosting resources
ASP site
Golf resources
iPod resources
Coupons and deals
Baby names
Domain names
Dating site
Scripts directory
Maxi directory
bigarticle : free articles
dawgwitch search
List of directories






beginners PHP Copyright © 2004 onwards by beginnersPHP.