PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Crc32 Validator

The Crc32 validator checks the content of a transferred file by hashing it. This validator uses the hash extension from PHP with the crc32 algorithm. It supports the following options:

  • *: Sets any key or use a numeric array. The values will be used as hash to validate against.

    You can set multiple hashes by using different keys. Each will be checked and the validation will fail only if all values fail.

Example 412. Using the Crc32 Validator

<?php
$upload 
= new Zend_File_Transfer();

// Checks whether the content of the uploaded file has the given hash
$upload->addValidator('Crc32'false'3b3652f');

// Limits this validator to two different hashes
$upload->addValidator('Crc32'false, array('3b3652f''e612b69'));

Zend Framework