The function filesize() works only on local files. To get the size of a remote file, use this code snippet:
<?php
$u = "http://www.your.url/file.zip";
$ourhead = "";
$url=parse_url($u);
$host=$url["host"];
$path=$url["path"];
$fp = fsockopen($host, 80, &$errno, &$errstr, 20);
if(!$fp) {
echo("error");
exit ();
} else {
fputs($fp,"HEAD $u HTTP/1.1\r\n");
fputs($fp,"HOST: dummy\r\n");
fputs($fp,"Connection: close\r\n\r\n");
while (!feof($fp)) {
$ourhead = sprintf("%s%s", $ourhead, fgets ($fp,128));
}
}
fclose ($fp);
$split_head = explode("Content-Length: ",$ourhead);
$size = round(abs($split_head[1])/1024);
print $size;
?>
Credit goes to Samir Joni from a PHPBuilder post on 2000-12-20.