public function uploadErrors($value, $options = []) {
		$defaults = [
			'allowNoFileError' => true
		];
		if (is_array($options)) {
			$options = array_merge($defaults, $options);
		} else {
			$options = $defaults;
		}
		if (isset($value['error']) && ($value['error'] !== null)) {
			switch ($value['error']) {
				case UPLOAD_ERR_OK:
					return true;
				case UPLOAD_ERR_INI_SIZE:
					$this->_uploadError = __d('file_storage', 'The uploaded file exceeds limit of %s.', Number::toReadableSize(ini_get('upload_max_filesize')));

					return false;
				case UPLOAD_ERR_FORM_SIZE:
					$this->_uploadError = __d('file_storage', 'The uploaded file is to big, please choose a smaller file or try to compress it.');

					return false;
				case UPLOAD_ERR_PARTIAL:
					$this->_uploadError = __d('file_storage', 'The uploaded file was only partially uploaded.');

					return false;
				case UPLOAD_ERR_NO_FILE:
					if ($options['allowNoFileError'] === false) {
						$this->_uploadError = __d('file_storage', 'No file was uploaded.');

						return false;
					}

					return true;
				case UPLOAD_ERR_NO_TMP_DIR:
					$this->_uploadError = __d('file_storage', 'The remote server has no temporary folder for file uploads. Please contact the site admin.');

					return false;
				case UPLOAD_ERR_CANT_WRITE:
					$this->_uploadError = __d('file_storage', 'Failed to write file to disk. Please contact the site admin.');

					return false;
				case UPLOAD_ERR_EXTENSION:
					$this->_uploadError = __d('file_storage', 'File upload stopped by extension. Please contact the site admin.');

					return false;
				default:
					$this->_uploadError = __d('file_storage', 'Unknown File Error. Please contact the site admin.');

					return false;
			}

			return false;
		}
		$this->_uploadError = '';

		return true;
	}
public function uploadErrors($value, $options = []) {
		$defaults = [
			'allowNoFileError' => true
		];
		if (is_array($options)) {
			$options = array_merge($defaults, $options);
		} else {
			$options = $defaults;
		}
		if (isset($value['error']) && ($value['error'] !== null)) {
			switch ($value['error']) {
				case UPLOAD_ERR_OK:
					return true;
				case UPLOAD_ERR_INI_SIZE:
					$this->_uploadError = __d('file_storage', 'The uploaded file exceeds limit of %s.', Number::toReadableSize(ini_get('upload_max_filesize')));

					return false;
				case UPLOAD_ERR_FORM_SIZE:
					$this->_uploadError = __d('file_storage', 'The uploaded file is to big, please choose a smaller file or try to compress it.');

					return false;
				case UPLOAD_ERR_PARTIAL:
					$this->_uploadError = __d('file_storage', 'The uploaded file was only partially uploaded.');

					return false;
				case UPLOAD_ERR_NO_FILE:
					if ($options['allowNoFileError'] === false) {
						$this->_uploadError = __d('file_storage', 'No file was uploaded.');

						return false;
					}

					return true;
				case UPLOAD_ERR_NO_TMP_DIR:
					$this->_uploadError = __d('file_storage', 'The remote server has no temporary folder for file uploads. Please contact the site admin.');

					return false;
				case UPLOAD_ERR_CANT_WRITE:
					$this->_uploadError = __d('file_storage', 'Failed to write file to disk. Please contact the site admin.');

					return false;
				case UPLOAD_ERR_EXTENSION:
					$this->_uploadError = __d('file_storage', 'File upload stopped by extension. Please contact the site admin.');

					return false;
				default:
					$this->_uploadError = __d('file_storage', 'Unknown File Error. Please contact the site admin.');

					return false;
			}

			return false;
		}
		$this->_uploadError = '';

		return true;
	}
public function uploadErrors ( $ value , $ options = [ ] ) { $ defaults = [ 'allowNoFileError' => true ] ; if ( is_array ( $ options ) ) { $ options = array_merge ( $ defaults , $ options ) ; } else { $ options = $ defaults ; } if ( isset ( $ value [ 'error' ] ) && ( $ value [ 'error' ] !== null ) ) { switch ( $ value [ 'error' ] ) { case UPLOAD_ERR_OK : return true ; case UPLOAD_ERR_INI_SIZE : $ this -> _uploadError = __d ( 'file_storage' , 'The uploaded file exceeds limit of %s.' , Number :: toReadableSize ( ini_get ( 'upload_max_filesize' ) ) ) ; return false ; case UPLOAD_ERR_FORM_SIZE : $ this -> _uploadError = __d ( 'file_storage' , 'The uploaded file is to big, please choose a smaller file or try to compress it.' ) ; return false ; case UPLOAD_ERR_PARTIAL : $ this -> _uploadError = __d ( 'file_storage' , 'The uploaded file was only partially uploaded.' ) ; return false ; case UPLOAD_ERR_NO_FILE : if ( $ options [ 'allowNoFileError' ] === false ) { $ this -> _uploadError = __d ( 'file_storage' , 'No file was uploaded.' ) ; return false ; } return true ; case UPLOAD_ERR_NO_TMP_DIR : $ this -> _uploadError = __d ( 'file_storage' , 'The remote server has no temporary folder for file uploads. Please contact the site admin.' ) ; return false ; case UPLOAD_ERR_CANT_WRITE : $ this -> _uploadError = __d ( 'file_storage' , 'Failed to write file to disk. Please contact the site admin.' ) ; return false ; case UPLOAD_ERR_EXTENSION : $ this -> _uploadError = __d ( 'file_storage' , 'File upload stopped by extension. Please contact the site admin.' ) ; return false ; default : $ this -> _uploadError = __d ( 'file_storage' , 'Unknown File Error. Please contact the site admin.' ) ; return false ; } return false ; } $ this -> _uploadError = '' ; return true ; }
Validates the error value that comes with the file input file.

@param array $value
@param array $options
@return bool True on success, if false the error message is set to the models field and also set in $this->_uploadError
Validates the error value that comes with the file input file .