Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: testing for a zip file

by adrianh (Chancellor)
on Aug 29, 2003 at 21:10 UTC ( [id://287834]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://287834]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2024-04-25 11:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found