mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-06 16:16:53 +01:00
else if => elseif
This commit is contained in:
@@ -183,18 +183,18 @@ class CFileValidator extends CValidator
|
||||
{
|
||||
if(null===$file || ($error=$file->getError())==UPLOAD_ERR_NO_FILE)
|
||||
return $this->emptyAttribute($object, $attribute);
|
||||
else if($error==UPLOAD_ERR_INI_SIZE || $error==UPLOAD_ERR_FORM_SIZE || $this->maxSize!==null && $file->getSize()>$this->maxSize)
|
||||
elseif($error==UPLOAD_ERR_INI_SIZE || $error==UPLOAD_ERR_FORM_SIZE || $this->maxSize!==null && $file->getSize()>$this->maxSize)
|
||||
{
|
||||
$message=$this->tooLarge!==null?$this->tooLarge : Yii::t('yii','The file "{file}" is too large. Its size cannot exceed {limit} bytes.');
|
||||
$this->addError($object,$attribute,$message,array('{file}'=>$file->getName(), '{limit}'=>$this->getSizeLimit()));
|
||||
}
|
||||
else if($error==UPLOAD_ERR_PARTIAL)
|
||||
elseif($error==UPLOAD_ERR_PARTIAL)
|
||||
throw new CException(Yii::t('yii','The file "{file}" was only partially uploaded.',array('{file}'=>$file->getName())));
|
||||
else if($error==UPLOAD_ERR_NO_TMP_DIR)
|
||||
elseif($error==UPLOAD_ERR_NO_TMP_DIR)
|
||||
throw new CException(Yii::t('yii','Missing the temporary folder to store the uploaded file "{file}".',array('{file}'=>$file->getName())));
|
||||
else if($error==UPLOAD_ERR_CANT_WRITE)
|
||||
elseif($error==UPLOAD_ERR_CANT_WRITE)
|
||||
throw new CException(Yii::t('yii','Failed to write the uploaded file "{file}" to disk.',array('{file}'=>$file->getName())));
|
||||
else if(defined('UPLOAD_ERR_EXTENSION') && $error==UPLOAD_ERR_EXTENSION) // available for PHP 5.2.0 or above
|
||||
elseif(defined('UPLOAD_ERR_EXTENSION') && $error==UPLOAD_ERR_EXTENSION) // available for PHP 5.2.0 or above
|
||||
throw new CException(Yii::t('yii','File upload was stopped by extension.'));
|
||||
|
||||
if($this->minSize!==null && $file->getSize()<$this->minSize)
|
||||
@@ -224,7 +224,7 @@ class CFileValidator extends CValidator
|
||||
if($info=finfo_open(defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME))
|
||||
$mimeType=finfo_file($info,$file->getTempName());
|
||||
}
|
||||
else if(function_exists('mime_content_type'))
|
||||
elseif(function_exists('mime_content_type'))
|
||||
$mimeType=mime_content_type($file->getTempName());
|
||||
else
|
||||
throw new CException(Yii::t('yii','In order to use MIME-type validation provided by CFileValidator fileinfo PECL extension should be installed.'));
|
||||
|
||||
Reference in New Issue
Block a user