|
Posted by greg on 03/14/06 09:06
> In a sense he is right, it is not really straightforward to make the
> distinction, if you strictly mean the ascii character set.
>
> Binary just means that it consists of binary patterns or sequence of bits,
> varied in length and meaning. The content of a binary file only makes
> sense to an application which knows what the sequence of bits means. When
> a file is viewed in a text-editor, then the data is (possibly mistakenly)
> chopped up in 8-bits (or whatever), and the corresponding symbol of that
> value is displayed, which may or may not make any sense at all. Strictly
> speaking, the only difference between ascii and non-ascii would be whether
> or not each chunk of bits is *intended* to correspond to a specific symbol
> in the Ascii character table.
>
> If you by ascii generally mean plain readable/printable text, not
> necessarilly limited to ascii, then there is tools that could help you.
>
> http://dk2.php.net/mime_content_type
> http://pecl.php.net/package/fileinfo
>
> If you are on a linux/unix, check:
> http://www.freebsd.org/cgi/man.cgi?query=file
>
> You could just ignore the subtype, and only distinguish on mediatype
> between text and everything else.
>
> /Bent
Thank you for these explanations.
In fact, I should have told why I want know make the difference between
ascii and binary files.
I have a list of files to send via FTP from a local machien to a remote
server.
the ftp_put function needs an argument that can be FTP_ASCII or FTP_BINARY.
I don't know how to choose dynamicaly this argument as the must upload
various file types.
tia,
--
greg
Navigation:
[Reply to this message]
|