Re: Detecting Binaries

From: Date: Mon, 23 Feb 2004 22:21:50 +0000
Subject: Re: Detecting Binaries
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-178600@lists.php.net to get a copy of this message
Richard Davey wrote:
Hello Axel, Monday, February 23, 2004, 7:03:38 PM, you wrote: AIM> Guys, this isn't THAT stupid of a question is it? From my perspective, AIM> the way PHP seems to see it is that I should already know what kind of AIM> file I'm looking at. In most cases that's not an unreasonable AIM> assumption. Unfortunately, that's only good for most cases. PHP is rich Even Windows doesn't *know* what type of file you've got until you actually try and open it. You could rename a jpg to mp3 and you won't know about it until Winamp moans at you as you open it.
FTP programs seem to know what kind of file you are transferring. Hence the ability to switch the transfer between AUTO, BINARY and ASCII modes. I usually leave mine in AUTO mode and it seems to figure it out OK. I'd suggest looking at the source to an FTP client to see how they do it. filezilla is opensource: http://filezilla.sourceforge.net/ Good luck. Shane

« previous php.general (#178600) next »