public function upload($_field, $_base64 = false) {

        if ( !$this->checkUploadDir() ) {
            $this->errNum = 6;
            return false;
        }

		if ( $_base64 ) {
			$_data = $_POST[$_field];
			return $this->makeBase64Image( $_data );
		}

		$_localFile = $_FILES[$_field]['name'];
        if ( !$_localFile ) {
            $this->errNum = 10;
            return false;
        }
		$_tempFile = $_FILES[$_field]['tmp_name'];//原来是这样
        //$_tempFile = str_replace('\\\\', '\\', $_FILES[$_field]['tmp_name']);//MAGIC_QUOTES_GPC=OFF时，做了这样处理：$_FILES = daddslashes($_FILES);图片上传后tmp_name值变成 X:\\Temp\\php668E.tmp，结果move_uploaded_file() 函数判断为不合法的文件而返回FALSE。
		$_error_no = $_FILES[$_field]['error'];
        $this->fileInfo['file_type'] = $_FILES[$_field]['type'];
        $this->fileInfo['local_name'] = $_localFile;
        $this->fileInfo['file_size'] = $_FILES[$_field]['size'];

        $this->errNum = $_error_no;
        if ( $this->errNum == 0 ) {
            $this->checkFileType($_localFile);
            if ( $this->errNum == 0 ) {
                $this->checkFileSize($_tempFile);
                if ( $this->errNum == 0 ) {
                    if ( is_uploaded_file($_tempFile) ) {
                        $_new_filename = $this->getFileName($_localFile);
                        $this->fileInfo['file_path'] = $this->config['upload_dir'].DIRECTORY_SEPARATOR.$_new_filename;
                        if ( move_uploaded_file($_tempFile, $this->fileInfo['file_path']) ) {

                            $_filename = $_new_filename;
                            $this->fileInfo['file_name'] = $_filename;
                            $pathinfo = pathinfo($this->fileInfo['file_path']);
                            $this->fileInfo['file_ext'] =  $pathinfo['extension'];
                            $this->fileInfo['raw_name'] = $pathinfo['filename'];

                            return $this->fileInfo;

                        } else {
                            $this->errNum = 7;
                        }
                    }
                }
            }
        }

		return false;

	}
public function upload($_field, $_base64 = false) {

        if ( !$this->checkUploadDir() ) {
            $this->errNum = 6;
            return false;
        }

		if ( $_base64 ) {
			$_data = $_POST[$_field];
			return $this->makeBase64Image( $_data );
		}

		$_localFile = $_FILES[$_field]['name'];
        if ( !$_localFile ) {
            $this->errNum = 10;
            return false;
        }
		$_tempFile = $_FILES[$_field]['tmp_name'];//原来是这样
        //$_tempFile = str_replace('\\\\', '\\', $_FILES[$_field]['tmp_name']);//MAGIC_QUOTES_GPC=OFF时，做了这样处理：$_FILES = daddslashes($_FILES);图片上传后tmp_name值变成 X:\\Temp\\php668E.tmp，结果move_uploaded_file() 函数判断为不合法的文件而返回FALSE。
		$_error_no = $_FILES[$_field]['error'];
        $this->fileInfo['file_type'] = $_FILES[$_field]['type'];
        $this->fileInfo['local_name'] = $_localFile;
        $this->fileInfo['file_size'] = $_FILES[$_field]['size'];

        $this->errNum = $_error_no;
        if ( $this->errNum == 0 ) {
            $this->checkFileType($_localFile);
            if ( $this->errNum == 0 ) {
                $this->checkFileSize($_tempFile);
                if ( $this->errNum == 0 ) {
                    if ( is_uploaded_file($_tempFile) ) {
                        $_new_filename = $this->getFileName($_localFile);
                        $this->fileInfo['file_path'] = $this->config['upload_dir'].DIRECTORY_SEPARATOR.$_new_filename;
                        if ( move_uploaded_file($_tempFile, $this->fileInfo['file_path']) ) {

                            $_filename = $_new_filename;
                            $this->fileInfo['file_name'] = $_filename;
                            $pathinfo = pathinfo($this->fileInfo['file_path']);
                            $this->fileInfo['file_ext'] =  $pathinfo['extension'];
                            $this->fileInfo['raw_name'] = $pathinfo['filename'];

                            return $this->fileInfo;

                        } else {
                            $this->errNum = 7;
                        }
                    }
                }
            }
        }

		return false;

	}
public function upload ( $ _field , $ _base64 = false ) { if ( ! $ this -> checkUploadDir ( ) ) { $ this -> errNum = 6 ; return false ; } if ( $ _base64 ) { $ _data = $ _POST [ $ _field ] ; return $ this -> makeBase64Image ( $ _data ) ; } $ _localFile = $ _FILES [ $ _field ] [ 'name' ] ; if ( ! $ _localFile ) { $ this -> errNum = 10 ; return false ; } $ _tempFile = $ _FILES [ $ _field ] [ 'tmp_name' ] ; //原来是这样 //$_tempFile = str_replace('\\\\', '\\', $_FILES[$_field]['tmp_name']);//MAGIC_QUOTES_GPC=OFF时，做了这样处理：$_FILES = daddslashes($_FILES);图片上传后tmp_name值变成 X:\\Temp\\php668E.tmp，结果move_uploaded_file() 函数判断为不合法的文件而返回FALSE。 $ _error_no = $ _FILES [ $ _field ] [ 'error' ] ; $ this -> fileInfo [ 'file_type' ] = $ _FILES [ $ _field ] [ 'type' ] ; $ this -> fileInfo [ 'local_name' ] = $ _localFile ; $ this -> fileInfo [ 'file_size' ] = $ _FILES [ $ _field ] [ 'size' ] ; $ this -> errNum = $ _error_no ; if ( $ this -> errNum == 0 ) { $ this -> checkFileType ( $ _localFile ) ; if ( $ this -> errNum == 0 ) { $ this -> checkFileSize ( $ _tempFile ) ; if ( $ this -> errNum == 0 ) { if ( is_uploaded_file ( $ _tempFile ) ) { $ _new_filename = $ this -> getFileName ( $ _localFile ) ; $ this -> fileInfo [ 'file_path' ] = $ this -> config [ 'upload_dir' ] . DIRECTORY_SEPARATOR . $ _new_filename ; if ( move_uploaded_file ( $ _tempFile , $ this -> fileInfo [ 'file_path' ] ) ) { $ _filename = $ _new_filename ; $ this -> fileInfo [ 'file_name' ] = $ _filename ; $ pathinfo = pathinfo ( $ this -> fileInfo [ 'file_path' ] ) ; $ this -> fileInfo [ 'file_ext' ] = $ pathinfo [ 'extension' ] ; $ this -> fileInfo [ 'raw_name' ] = $ pathinfo [ 'filename' ] ; return $ this -> fileInfo ; } else { $ this -> errNum = 7 ; } } } } } return false ; }
upload file method.
@param        sting $_field name of form elements.
@param        bool $_base64
@return       mixed false or file info array.
upload file method .