-3

i've using this link for getting remote file size but i am getting sizes in bites i want to show that in Kb,Mb or in Gb

Community
  • 1
  • 1

2 Answers2

0

You can convert your bytes value into kb/mb/gb

1 byte = 0.001 KB

1 kb = 0.001 MB

likewise.

jarvo69
  • 6,706
  • 2
  • 17
  • 25
  • In some situations, you might want to divide bytes by 1024 instead of 1000 to get kilobytes, and again by 1024 to get megabytes. – roderick young Aug 20 '16 at 06:08
-1

Well the easiest way is just get the result and divide it by 1024 for K, 1024 again for Meg, and 1024 again for Gig?

So
$bytes = curl_get_file_size( $url );
Then
$kbytes = $bytes / 1024;
$mbytes = $kbytes / 1024;
$gbytes = $mbytes / 1024;

Forbs
  • 1,211
  • 1
  • 6
  • 9