note 28184 deleted from function.filesize by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 01 Sep 2004 17:33:17 +0000 |
| Subject: | note 28184 deleted from function.filesize by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75881@lists.php.net to get a copy of this message | ||
Note Submitter: thebitman at attbi dot com
----
Though the above-posted method for getting the remote file size is probably the fastest, this
improvement to x@x.com's method is a lot faster than the original:
function remotefiletoobig($file,$maxbytes) {
// $maxbytes; // in bytes
// Open the file, but only read maximum size
$fp = fopen($file, "r");
$first_file_size_read = fread($fp, $maxbytes + 1);
fclose($fp);
return (strlen($first_file_size_read) > $maxbytes);
}