hasZipMimeType.php
Table of Contents
Functions
- hasZipMimeType() : bool
- Checks if a file has a zip-related MIME type.
Functions
hasZipMimeType()
Checks if a file has a zip-related MIME type.
hasZipMimeType(string $filePath[, array<string|int, string> $mimeTypes = ['application/zip', 'application/x-zip', 'application/x-zip-compressed', 'application/zip-compressed', 'multipart/x-zip'] ]) : bool
This function inspects the MIME type of the given file against a list of valid zip-related MIME types to determine if the file is a zip archive.
It is a thin wrapper around hasMimeType() pre-configured with the common zip MIME types.
Parameters
- $filePath : string
-
Path to the file.
- $mimeTypes : array<string|int, string> = ['application/zip', 'application/x-zip', 'application/x-zip-compressed', 'application/zip-compressed', 'multipart/x-zip']
-
Optional list of valid zip MIME types. Defaults to common zip types:
- 'application/zip'
- 'application/x-zip'
- 'application/x-zip-compressed'
- 'application/zip-compressed'
- 'multipart/x-zip'
Tags
Return values
bool —True if the file exists and its MIME type matches one of the given zip MIME types.