filesize in php
snippet in php

filesize in php

user7831

$file = '/path/to/your/file';
$filesize = filesize($file); // bytes
$filesize = round($filesize / 1024 / 1024, 1); // megabytes with 1 digit
 
echo "The size of your file is $filesize MB.";

php get size of file

user3812

$fileSizeInBytes=filesize("/path/to/myfile.txt"); 

filesize in php

user5685

$file = '/path/to/your/file';
$filesize = filesize($file);
 
echo "The size of your file is $filesize bytes.";

filesize in php

user6659

$file = '/path/to/your/file';
$filesize = filesize($file); // bytes
$filesize = round($filesize / 1024, 2); // kilobytes with two digits
 
echo "The size of your file is $filesize KB.";