in reply to Re: testing for a zip file
in thread testing for a zip file
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.
|
|---|