Hash validator checks the content of a transferred file by
hashing it. This validator uses the hash extension from PHP. It
supports the following options:
*: Takes any key or use a numeric array. Sets the hash to validate against.
You can set multiple hashes by passing them as an array. Each file is checked, and the validation will fail only if all files fail validation.
algorithm: Sets the algorithm to use for hashing the content.
You can set multiple algorithm by calling the
addHash()method multiple times.
Example 408. Using the Hash Validator
$upload = new Zend_File_Transfer();
// Checks if the content of the uploaded file contains the given hash
$upload->addValidator('Hash', false, '3b3652f');
// Limits this validator to two different hashes
$upload->addValidator('Hash', false, array('3b3652f', 'e612b69'));
// Sets a different algorithm to check against
'algorithm' => 'md5'));