选择语言 :

 Core_Upload::check_is_upload_file

判断是否上传的文件

boolean Core_Upload::check_is_upload_file( )
返回值
  • boolean
File: ./core/classes/upload.class.php
protected function check_is_upload_file()
{
    // 非上传的文件做抛错处理
    if(!is_uploaded_file($this->file['tmp_name']))
    {
        $error = (!isset($this->file['error'])) ? 4 : $this->file['error'];

        switch($error)
        {
            case UPLOAD::ERR_INI_SIZE :
                throw new Exception('Upload file exceeds limit', $error);
                break;
            case UPLOAD::ERR_FORM_SIZE :
                throw new Exception('Upload file exceeds form limit', $error);
                break;
            case UPLOAD::ERR_PARTIAL :
                throw new Exception('Upload file partial', $error);
                break;
            case UPLOAD::ERR_NO_FILE :
                throw new Exception('Upload no file selected', $error);
                break;
            case UPLOAD::ERR_NO_TMP_DIR :
                throw new Exception('Upload no temp directory', $error);
                break;
            case UPLOAD::ERR_CANT_WRITE :
                throw new Exception('Upload unable to write file', $error);
                break;
            case UPLOAD::ERR_EXTENSION :
                throw new Exception('Upload stopped by extension', $error);
                break;
            default :
                throw new Exception('Upload no file selected', $error);
                break;
        }

        return false;
    }
    else
    {
        return true;
    }
}