Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

First lets get File Size:

https://wpguru.co.uk/2014/03/how-to-check-the-size-of-a-file-in-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, 2); // kilobytes with two digits

echo "The size of your file is $filesize KB.";
$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.";

If Statement:

http://stackoverflow.com/questions/16421617/if-value-is-greater-lesser-than-xyz

if($filesize >=100)
{
echo "filesize is greater than 100 bytes";
}
  • No labels

1 Comment