note 62259 added to function.filesize

From: Date: Thu, 23 Feb 2006 14:24:53 +0000
Subject: note 62259 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-104303@lists.php.net to get a copy of this message
For HTTP and other streams based files, you can use a stream notifier to get the filesize. You don't have to resort to cURL or header parsing yourself.

<?php
 $ctxt = stream_context_create();
 stream_context_set_params($ctxt, array( "notification" => "notifier" ) );
 $f = fopen ($url, "rb", false, $ctxt );


 function notifier( $code, $severity, $msg, $xcode, $sofar, $fileSize )
 {
 if ( $code == STREAM_NOTIFY_FILE_SIZE_IS )
 {
 echo "SIZE = $fileSize\n";
 }
 }
?> ---- Server IP: 66.163.161.117 Probable Submitter: 80.239.98.162 ---- Manual Page -- http://www.php.net/manual/en/function.filesize.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62259 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62259&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62259&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62259&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62259&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62259&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62259&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62259&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62259&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104303) next »