The file 'file.txt' was last modified <?php InsertModified("file.txt"); ?>.
InsertModified( file )
<?php
//-----------------------------------------------------
// InsertModified($file,$offset,$format)
// - - - - - - - -
// Prints the date the file was last modifed.
//
// See InsertDate().
//-----------------------------------------------------
function InsertModified($file, $offset=0, $format="long")
{
$kHour = 60*60;
if( strcasecmp($format,"long") == 0 )
print date("l, F j, Y",filemtime("manual.zip")+$offset*$kHour);
else
print date("m/d/y",filemtime("manual.zip")+$offset*$kHour);
}
?>
The file 'file1.txt' is <?php InsertFilesize("file1.txt","B"); ?> bytes.
The file 'file2.txt' is <?php InsertFilesize("file2.txt","K"); ?> kilobytes.
The file 'file3.txt' is <?php InsertFilesize("file3.txt","M"); ?> megabytes.
InsertFilesize( file, sizeSpec )
<?php
//-----------------------------------------------------
// InsertFilesize($file,$sizeSpec)
// - - - - - - - - - - - - - - - -
// Prints the size of the file according to $sizeSpec.
//
// $sizeSpec = "B" - size printed in bytes.
// = "K" - size printed in kilobytes.
// = "M" - size printed in megabytes.
//
// See GetFilesize().
//-----------------------------------------------------
function InsertFilesize( $file, $sizeSpec = "B" )
{
print GetFilesize($file,$sizeSpec);
}
?>
GetFilesize( file, sizeSpec )
<?php
//-----------------------------------------------------
// GetFilesize($file,$sizeSpec)
// - - - - - - - - - - - - - -
// Returns the size of the file according to $sizeSpec.
//
// $sizeSpec = "B" - size printed in bytes.
// = "K" - size printed in kilobytes.
// = "M" - size printed in megabytes.
//-----------------------------------------------------
function GetFilesize( $file, $sizeSpec = "B" )
{
if( strcmp($sizeSpec,"B") == 0 )
return filesize($file);
else if( strcmp($sizeSpec,"K") == 0 )
return floor(filesize("manual.zip")/1024);
else if( strcmp($sizeSpec,"M") == 0 )
return sprintf("%.1f",filesize("manual.zip")/1024/1024);
}
?>