note 28184 added to function.filesize
| From: | thebitman at attbi dot com | Date: | Sun, 05 Jan 2003 01:52:17 +0000 |
| Subject: | note 28184 added to function.filesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41678@lists.php.net to get a copy of this message | ||
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);
}
--
http://www.php.net/manual/en/function.filesize.php
http://master.php.net/manage/user-notes.php?action=edit+28184
http://master.php.net/manage/user-notes.php?action=delete+28184
http://master.php.net/manage/user-notes.php?action=reject+28184