note 84130 added to function.filesize

From: Date: Mon, 30 Jun 2008 10:38:12 +0000
Subject: note 84130 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-141001@lists.php.net to get a copy of this message
function getSizeFile($url) { if (substr($url,0,4)=='http') { $x = array_change_key_case(get_headers($url, 1),CASE_LOWER); if ( strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0 ) { $x = $x['content-length'][1]; } else { $x = $x['content-length']; } } else { $x = @filesize($url); } return $x; } In case of you have a redirection in the server (like Redirect Permanent in the .htaccess) In this case we have for exemple: [content-length] => Array ( [0] => 294 // Size requested file [1] => 357556 // Real Size redirected file ) ---- Server IP: 80.64.47.13 Probable Submitter: 85.50.140.224 ---- Manual Page -- http://www.php.net/manual/en/function.filesize.php Edit -- https://master.php.net/note/edit/84130 Del: integrated -- https://master.php.net/note/delete/84130/integrated Del: useless -- https://master.php.net/note/delete/84130/useless Del: bad code -- https://master.php.net/note/delete/84130/bad+code Del: spam -- https://master.php.net/note/delete/84130/spam Del: non-english -- https://master.php.net/note/delete/84130/non-english Del: in docs -- https://master.php.net/note/delete/84130/in+docs Del: other reasons-- https://master.php.net/note/delete/84130 Reject -- https://master.php.net/note/reject/84130 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141001) next »