Created
April 27, 2019 22:21
-
-
Save gabyfle/c8e556ec054f0dc4bb92e35c39c93310 to your computer and use it in GitHub Desktop.
Checks if an uploaded file is a .zip one.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isZip(string $tmp, string $name) | |
{ | |
$extension = pathinfo($name, PATHINFO_EXTENSION); | |
$finfo = finfo_open(FILEINFO_MIME_TYPE); | |
$type = finfo_file($finfo, $tmp); | |
return $type === 'application/zip' && $extension === 'zip'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment