note 68209 modified in function.filesize by danbrown
| From: | danbrown@php.net | Date: | Sun, 18 Jan 2009 18:08:25 +0000 |
| Subject: | note 68209 modified in function.filesize by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149414@lists.php.net to get a copy of this message | ||
If you want to get the actual filesize for a size above 2 gb in Windows, you can use the
COM-extensions in PHP.
An example is as follows:
<?php
function knj_filesize($file){
if (file_exists($file)){
$fsobj = new COM("Scripting.FileSystemObject");
$file = $fsobj->GetFile($file);
$var = ($file->Size) + 1 - 1;
return $var;
}else{
echo "File does not exist.\n";
return false;
}
}
?>
This will return the corrent filesize. And it is very useful with PHP-GTK applications, where you
want to use the filesize for larger files.
This example also works for files over a Windows-network. Try this example with the function:
<?php
echo knj_filesize("//mycomputer/music/Track1.mp3");
?>
Happy hacking :)
--was--
If you want to get the actual filesize for a size above 2 gb in Windows, you can use the
COM-extensions in PHP.
An example is as follows:
<?php
function knj_filesize($file){
if (file_exists($file)){
$fsobj = new COM("Scripting.FileSystemObject");
$file = $fsobj->GetFile($file);
$var = ($file->Size) + 1 - 1;
return $var;
}else{
echo "File does not exist.\n";
return false;
}
}
?>
This will return the corrent filesize. And it is very useful with PHP-GTK applications, where you
want to use the filesize for larger files.
This example also works for files over a Windows-network. Try this example with the function:
<?
echo knj_filesize("//mycomputer/music/Track1.mp3");
?>
Happy hacking :)
http://php.net/manual/en/function.filesize.php