filesize in php

PHP
$file = '/path/to/your/file';
$filesize = filesize($file);
 
echo "The size of your file is $filesize bytes.";
$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.";
$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.";
$fileSizeInBytes=filesize("/path/to/myfile.txt"); 
Source

Also in PHP: