Re: Detecting Binaries

From: Date: Mon, 23 Feb 2004 19:03:38 +0000
Subject: Re: Detecting Binaries
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-178570@lists.php.net to get a copy of this message
Guys, this isn't THAT stupid of a question is it? From my perspective, the way PHP seems to see it is that I should already know what kind of file I'm looking at. In most cases that's not an unreasonable assumption. Unfortunately, that's only good for most cases. PHP is rich in ways to work with the HTTP protocol, but has no way of detecting whether it's opening a text file or a binary file. To me this is a glaring omission. There has to be a way to do it, even if it's a round-a-bout or backdoor kind of way. Nothing is impossible. Nick Axel IS Main wrote:
I'm using file_get_contents() to open URLs. Does anyone know if there is a way to look at the result and determine if the file is binary? I'd like to be able to block binaries from being processed without having to try to think of all the possible binary extensions and omit them with a function that looks for these extensions. Nick


« previous php.general (#178570) next »