fstat determines the file size without acrobatics:
$f = fopen('file', 'r+'); $stat = fstat($f); $size = $stat['size'];
ftell cannot be used when the file was opened with the append ( "a" ) flag. In addition, you must first search at the end of the fseek($f, 0, SEEK_END) file fseek($f, 0, SEEK_END) .
source share