PHP/File Directory/filesize

Материал из Web эксперт
Перейти к: навигация, поиск

Determining File Size with filesize()

 
<?
print "The size of test.txt is. ";
print filesize( "test.txt" );
?>



filesize() function returns the size, in bytes.

 
Its syntax is: int filesize (string filename)
<?
    $fs = filesize("data.txt");
    print "Pastry.txt is $fs bytes.";
?>



filesize.php

 
<?php
   $file = "data.txt";
   $bytes = filesize("$file"); 
   echo "File ".basename($file)." is $bytes bytes, or ".round($bytes / 1024, 2)." kilobytes.";
?>