Re: Get a file's version in PHP
- From: Peter van Schie <vanschie.peter@xxxxxxxxx>
- Date: Sun, 30 Oct 2005 14:32:17 +0100
Another option, without using COM, would be to open the binary file and search for the pattern F\0i\0l\0e\0V\0e\0r\0s\0i\0o\0n\0\0\0\0\0
The version is right behind that string:
$strFile = "c:\\my.exe"; $fpFile = fopen($strFile, "rb"); $strFileContent = fread($fpFile, filesize($strFile)); fclose($fpFile);
$strTagBefore = 'F\0i\0l\0e\0V\0e\0r\0s\0i\0o\0n\0\0\0\0\0';
$strTagAfter = '\0\0';
if (preg_match("/$strTagBefore(.*?)$strTagAfter/", $strFileContent, $arrMatches))
{
print_r($arrMatches);
}
HTH. Peter. -- http://www.phpforums.nl .
- References:
- Re: Get a file's version in PHP
- From: Janwillem Borleffs
- Re: Get a file's version in PHP
- From: Marius III
- Re: Get a file's version in PHP
- From: Janwillem Borleffs
- Re: Get a file's version in PHP
- Prev by Date: Re: Get a file's version in PHP
- Next by Date: Re: Question on PhP, MySQL
- Previous by thread: Re: Get a file's version in PHP
- Next by thread: Re: Get a file's version in PHP
- Index(es):
Relevant Pages
|