Home › Forums › Back End › cannot set header('Content-Length') greater than 2GB › Reply To: cannot set header('Content-Length') greater than 2GB
May 21, 2015 at 1:58 pm
#202681
ovi
Participant
you can try the following function instead of my_filesize()
:
function remote_filesize($url) {
static $regex = '/^Content-Length: *+Kd++$/im';
if (!$fp = @fopen($url, 'rb')) {
return false;
}
if (
isset($http_response_header) &&
preg_match($regex, implode("n", $http_response_header), $matches)
) {
return (int)$matches[0];
}
return strlen(stream_get_contents($fp));
}
Source: http://php.net/manual/en/function.filesize.php#114952