protected function getPostBody()
    {
        $data = '';
        if (count($this->_postFiles) > 0) {
            $boundary = md5($this->_rawUrl . microtime());
            foreach ($this->_postFields as $k => $v) {
                $data .= '--' . $boundary . Client::CRLF . 'Content-Disposition: form-data; name="' . $k . '"'
                    . Client::CRLF . Client::CRLF . $v . Client::CRLF;
            }
            foreach ($this->_postFiles as $k => $v) {
                $ext = strtolower(substr($v[0], strrpos($v[0], '.') + 1));
                $type = isset(self::$_mimes[$ext]) ? self::$_mimes[$ext] : 'application/octet-stream';
                $data .= '--' . $boundary . Client::CRLF . 'Content-Disposition: form-data; name="' . $k . '"; filename="' . $v[0] . '"'
                    . Client::CRLF . 'Content-Type: ' . $type . Client::CRLF . 'Content-Transfer-Encoding: binary'
                    . Client::CRLF . Client::CRLF . $v[1] . Client::CRLF;
            }
            $data .= '--' . $boundary . '--' . Client::CRLF;
            $this->setHeader('content-type', 'multipart/form-data; boundary=' . $boundary);
        } else {
            if (count($this->_postFields) > 0) {
                foreach ($this->_postFields as $k => $v) {
                    $data .= '&' . rawurlencode($k) . '=' . rawurlencode($v);
                }
                $data = substr($data, 1);
                $this->setHeader('content-type', 'application/x-www-form-urlencoded');
            }
        }
        return $data;
    }