note 104101 deleted from function.filesize by aharvey
| From: | aharvey@php.net | Date: | Tue, 22 Jan 2013 00:20:38 +0000 |
| Subject: | note 104101 deleted from function.filesize by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193331@lists.php.net to get a copy of this message | ||
Note Submitter: swimming at gmx dot de
----
I found the following to be a nice solution (if you are running Windows) for the >4GB problem.
Using the Windows internal Scripting.FileSystemObject you can get the file size using the following
code:
<?php
$filesystem = new COM('Scripting.FileSystemObject');
$file = $filesystem->GetFile($filename);
$size = $file->Size();
?>
The file size will be returned as integer for small files, automatically changing to float for
bigger ones. The COM class is part of the PHP core.