Posted by Colin McKinnon on 02/18/07 15:54
Schraalhans Keukenmeester wrote:
> Is it possible in PHP to determine whether a file is (intended as)
> binary or ascii data other than by examining its extension? I can't find
> a ready-made function or script online that does so.
>
> If I open a file with less on my linux box for example it warns when it
> 'thinks' it's binary rather than ascii.
>
The 'file' command from the shell prompt will give you the file type. There
are a wealth of tools for handling files available from the shell you might
want to read the man pages for 'cat', 'tr' and 'strings' too.
HTH
C.
Navigation:
[Reply to this message]
|