Is there anyway that I can determine the filesize of a file on a remote server?
Filesize
Started by Crane, May 08 2007 10:23 AM
3 replies to this topic
#1
Posted 08 May 2007 - 10:23 AM
|
|
|
#2
Posted 08 May 2007 - 10:26 AM
You can open a file on another server, using fopen().
The "get file"-thing you probably have to do by yourself, but it isn't hard. You just loops through the content of the file and increments a size variable, when finding a single character.
Character = 1 byte.
The "get file"-thing you probably have to do by yourself, but it isn't hard. You just loops through the content of the file and increments a size variable, when finding a single character.
Character = 1 byte.
#3
Posted 08 May 2007 - 02:35 PM
This should work for PHP > 5.0
There are a bunch of code regarding this over here PHP: filesize - Manual
<?php
function getSize($fn){
$ary_header = get_headers($fn, 1);
$filesize = $ary_header['Content-Length'];
return $filesize;
}
?>
There are a bunch of code regarding this over here PHP: filesize - Manual
#4
Posted 13 May 2007 - 06:44 PM
As long as your on php 5.0 or above, filesize("http://thissite.org/index.html"); will work. Else, Sidewinders code does work.


Sign In
Create Account


Back to top









