Created
January 4, 2016 17:02
-
-
Save maxkostinevich/76d488814a6a7cc8222b to your computer and use it in GitHub Desktop.
PHP: Determine how many bytes sent over http
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Determine how many bytes sent over http | |
ignore_user_abort(true); | |
$handle = fopen($file_path, 'r'); | |
while ( ! feof($handle)) { | |
echo fread($handle, 4096); | |
if (connection_aborted()) { | |
$transfer_success = false; | |
$bytes_transferred = ftell($handle); | |
break; | |
} | |
} | |
fclose($handle); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment