Phorm/Field/FileUpload.class.php
/**
	 * Throws a ValidationError if the file upload resulted in an error, if
	 * the file was not a valid type, or if the file exceded the maximum size.
	 *
	 * @param mixed $value
	 * @return null
	 * @throws Phorm_ValidationError
	 */
Throws a ValidationError if the file upload resulted in an error, if
the file was not a valid type, or if the file exceded the maximum size.

@param mixed $value
@return null
@throws Phorm_ValidationError
Throws a ValidationError if the file upload resulted in an error if the file was not a valid type or if the file exceded the maximum size . @param mixed $value @return null @throws Phorm_ValidationError
public function validate($value)
	{
		$file = $this->get_file_data();
		if( $file['error'] )
		{
			throw new Phorm_ValidationError($file['error']);
		}
		if( is_array($this->types) && !in_array($file['type'], $this->types) )
		{
			throw new Phorm_ValidationError(serialize(array('field_file_badtype', $file['type'])));
		}
		if( $file['size'] > $this->max_size )
		{
			throw new Phorm_ValidationError(serialize(array( 'field_file_sizelimit', number_format($this->max_size))) );
		}
	}
public function validate ( $ value ) { $ file = $ this -> get_file_data ( ) ; if ( $ file [ 'error' ] ) { throw new Phorm_ValidationError ( $ file [ 'error' ] ) ; } if ( is_array ( $ this -> types ) && ! in_array ( $ file [ 'type' ] , $ this -> types ) ) { throw new Phorm_ValidationError ( serialize ( array ( 'field_file_badtype' , $ file [ 'type' ] ) ) ) ; } if ( $ file [ 'size' ] > $ this -> max_size ) { throw new Phorm_ValidationError ( serialize ( array ( 'field_file_sizelimit' , number_format ( $ this -> max_size ) ) ) ) ; } }
Throws a ValidationError if the file upload resulted in an error, if
 the file was not a valid type, or if the file exceded the maximum size.
Throws a ValidationError if the file upload resulted in an error if the file was not a valid type or if the file exceded the maximum size .