tags:

views:

55

answers:

1

I want to know how many Kb,Mb an image is by PHP

+5  A: 

Use the filesize function:

$size = filesize('image.jpg'); // Returns size in bytes

To find out the size in Kilobytes or Megabytes:

$size_in_kb = round($size / 1024, 2);
$size_in_mb = round($size / (1024 * 1024), 2);
Tomas Markauskas