ZIP file validator
Enables runtime validation of ZIP files with error reporting.
When installed, this module automatically validates any uploaded Z The Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Get reason why last isValidFilename() returned false Is the given filename allowed for extraction from a Z Set verbose mode for error reporting (useful for debugging) If a ZipArchive instance is already available it can be provided here In addition to the methods and properties above, FileValidatorZip also inherits the methods and properties of these classes:$files->unzip() method to validate ZrequireFiles and fatalFiles optionally support regex patterns.
When using regex patterns, the ! character must be used as the starting/ending delimiter.// Usage example
$v = $modules->get('FileValidatorZip');
$v->setVerbose(true); // return verbose errors (useful for debugging)
// Below are all settings with default values. You do not have to specify the
// settings unless you want to change them from the defaults.
$v->minFiles = 1; // Min files allowed
$v->maxFiles = 1000; // Max files allowed
$v->maxDepth = 8; // Max directory/folder depth allowed
$v->maxFileMegabytes = 20; // Max uncompressed megabytes for any 1 file in ZFileValidatorZip class also inherits all the methods and properties of: FileValidatorModule, WireData and Wire.Common
Name Return Summary None string bool None None Properties
Name Return Summary FileValidatorZip::allowEncrypted bool Allow encrypted files?
DEFAULT: false FileValidatorZip::fatalFiles array File names or regex patterns that when matched, cause entire validation to fail
DEFAULT: [] FileValidatorZip::maxCompRatio int Max allowed compression ratio or 0 to ignore
DEFAULT: 0 FileValidatorZip::maxDepth int Maximum allowed folder/directory depth in Z
DEFAULT: 8 FileValidatorZip::maxErrors int Maximum number of errors to report before giving up
DEFAULT: 10 FileValidatorZip::maxFileMegabytes int Maximum allowed uncompressed size of any individual file in Z
DEFAULT: 20 FileValidatorZip::maxFiles int Maximum number of files allowed in Z
DEFAULT: 1000 FileValidatorZip::maxTotalMegabytes int Maximum allowed total uncompressed size of all files in Z
DEFAULT: 50 FileValidatorZip::minFiles int Minimum number files that must be present for a valid Z
DEFAULT: 1 FileValidatorZip::requireFiles array File names or regex patterns that must be present for Z
DEFAULT: [] Additional methods and properties
API reference based on ProcessWire core version 3.0.253