PhpRiot
Follow phpriot on Twitter
Sponsored Link
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
Free iPad/iPhone App
Available on the App Store

  • PHP manual
  • Zend Framework manual
  • Smarty manual
  • PHP articles
  • PHP training

Exists Validator

The Exists validator checks for the existence of specified files. It supports the following options:

  • *: Sets any key or use a numeric array to check if the specific file exists in the given directory.

This validator accepts multiple directories, either as a comma-delimited string, or as an array. You may also use the methods setDirectory(), addDirectory(), and getDirectory() to set and retrieve directories.

Example 402. Using the Exists Validator

<?php
$upload 
= new Zend_File_Transfer();

// Add the temp directory to check for
$upload->addValidator('Exists'false'\temp');

// Add two directories using the array notation
$upload->addValidator('Exists',
                      
false,
                      array(
'\home\images''\home\uploads'));

Note

Note that this validator checks whether the specified file exists in all of the given directories. The validation will fail if the file does not exist in any of the given directories.

Zend Framework