PHP/File Directory/filesize — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:04, 26 мая 2010
Determining File Size with filesize()
<source lang="html4strict">
<? print "The size of test.txt is. "; print filesize( "test.txt" ); ?>
</source>
filesize() function returns the size, in bytes.
<source lang="html4strict">
Its syntax is: int filesize (string filename) <?
$fs = filesize("data.txt"); print "Pastry.txt is $fs bytes.";
?>
</source>
filesize.php
<source lang="html4strict">
<?php
$file = "data.txt"; $bytes = filesize("$file"); echo "File ".basename($file)." is $bytes bytes, or ".round($bytes / 1024, 2)." kilobytes.";
?>
</source>