How can I get file size in PHP without opening the full file?
Posted on 2014-09-23
Using fopen() or similar methods load the full file when checking for file size which is a poor implementation, because when using large files, it is AWESOME(!). My file sizes could be as large as 2/3GB. However, in other places, I have seen tutorials like using cURL header responses. But I am on IIS, Windows Server 2008 R2, and IIS does not return the Content-Length header response. So the cURL method is useless.
How can I get file size in PHP without opening the file?