note 68209 deleted from function.filesize by aharvey
| From: | aharvey@php.net | Date: | Tue, 22 Jan 2013 00:20:09 +0000 |
| Subject: | note 68209 deleted from function.filesize by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193329@lists.php.net to get a copy of this message | ||
Note Submitter: kaspernj at gmail dot com
----
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 :)