protected function buildMultipart($mimeBoundary, $filename)
    {
        $binary = $this->getBinaryFile($filename);

        $details = pathinfo($filename);

        $type = $this->supportedMimes($details['extension']);

        $data = '--' . $mimeBoundary . static::EOL;
        $data .= 'Content-Disposition: form-data; name="media"; filename="' . $details['basename'] . '"' . static::EOL;
        $data .= 'Content-Type: application/octet-stream' . static::EOL . static::EOL;
        $data .= $binary . static::EOL;
        $data .= '--' . $mimeBoundary . '--' . static::EOL . static::EOL;

        unset($mimeBoundary, $filename, $binary, $details, $type);

        return $data;
    }