-1

I am facing a problem in one of my website.I have applied download data limit check and user have the option to download files in his/her profile.My question is:

How to find the download size of a file? So, I have applied the appropriate limit checks.

rajausman haider
  • 570
  • 2
  • 10
  • 20

2 Answers2

0

You could use PHP's filesize() function:

$size = filesize('/path/to/file');

This will return the size of the file in bytes.

Maltronic
  • 1,782
  • 10
  • 21
0

Try this..

Returns the size of the file in bytes, or FALSE (and generates an error of level E_WARNING) in case of an error.

Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.

<?php

// outputs e.g.  somefile.txt: 1024 bytes

$filename = 'somefile.txt';
echo $filename . ': ' . filesize($filename) . ' bytes';

?>

http://www.php.net/manual/en/function.filesize.php

Deenadhayalan Manoharan
  • 5,436
  • 14
  • 30
  • 50