note 110398 added to function.filesize

From: Date: Thu, 18 Oct 2012 10:42:57 +0000
Subject: note 110398 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-191417@lists.php.net to get a copy of this message
Getting the filesize of a remote file is not supported, since this function does not support STAT (hence the warning). However, when applying a HTTP address the request still got sent nonetheless, so the answer is already out there. We just have to inspect the response headers: <?php $iSize= @filesize( 'http://www.php.net/images/php.gif' ); if( $iSize=== FALSE && isset( $http_response_header ) && is_array( $http_response_header ) ) foreach( $http_response_header as $sHeader ) { if( preg_match( '#^Content-Length: ([0-9]+)$#i', $sHeader, $aMatch ) ) { $iSize= (int)$aMatch[1]; break; } } ?> ---- Server IP: 212.124.37.9 Probable Submitter: 85.180.158.38 ---- Manual Page -- http://www.php.net/manual/en/function.filesize.php Edit -- https://master.php.net/note/edit/110398 Del: integrated -- https://master.php.net/note/delete/110398/integrated Del: useless -- https://master.php.net/note/delete/110398/useless Del: bad code -- https://master.php.net/note/delete/110398/bad+code Del: spam -- https://master.php.net/note/delete/110398/spam Del: non-english -- https://master.php.net/note/delete/110398/non-english Del: in docs -- https://master.php.net/note/delete/110398/in+docs Del: other reasons-- https://master.php.net/note/delete/110398 Reject -- https://master.php.net/note/reject/110398 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#191417) next »