If the server sends a Content-Length header, you can call fsockopen and sending a HEAD request for the file.
$host = "localhost";
$url = "/apache_pb.gif";
$fp = fsockopen($host, 80);
socket_set_blocking($fp, TRUE);
fwrite($fp, "HEAD $url HTTP/1.0\r\nHost: $host\r\n\r\n");
for($result = ""; !feof($fp); $result .= fread($fp, 10000000));
fclose($fp);
preg_match("/content-length:\s?(\d+)/i", $result, $match);
echo $match[1];