You can check the first 2 bytes of the file. If they are PK, then you have a .zip file.
Or, to be slightly more accurate, if they are not PK you know that you don't have a .zip file :-)
There is nothing to stop a non-zip file starting with PK.
If you want to be sure use Archive::Zip to attempt to extract the file or check the file's CRCs.
In reply to Re: Re: testing for a zip file
by adrianh
in thread testing for a zip file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |