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
function getRemoteFilesize($url, $formatSize = true, $useHead = true) { | |
if (false !== $useHead) { | |
stream_context_set_default(array('http' => array('method' => 'HEAD'))); | |
} | |
$head = array_change_key_case(get_headers($url, 1)); | |
// content-length of download (in bytes), read from Content-Length: field | |
$clen = isset($head['content-length']) ? $head['content-length'] : 0; | |
// cannot retrieve file size, return "-1" |