src/Viserio/Component/Http/Stream/MultipartStream.php
private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers): array
    {
        // Set a default content-disposition header if one was no provided
        $disposition = $this->getHeader($headers, 'content-disposition');

        if (! $disposition) {
            $headers['Content-Disposition'] = ($filename === '0' || $filename)
                ? \sprintf(
                    'form-data; name="%s"; filename="%s"',
                    $name,
                    self::basename($filename)
                )
                : "form-data; name=\"{$name}\"";
        }

        // Set a default content-length header if one was no provided
        $length = $this->getHeader($headers, 'content-length');

        if (! $length) {
            if ($length = $stream->getSize()) {
                $headers['Content-Length'] = (string) $length;
            }
        }

        // Set a default Content-Type if one was not supplied
        $type = $this->getHeader($headers, 'content-type');

        if (! $type && ($filename === '0' || $filename)) {
            if ($type = MimeType::guess($filename)) {
                $headers['Content-Type'] = $type;
            }
        }

        return [$stream, $headers];
    }
private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers): array
    {
        // Set a default content-disposition header if one was no provided
        $disposition = $this->getHeader($headers, 'content-disposition');

        if (! $disposition) {
            $headers['Content-Disposition'] = ($filename === '0' || $filename)
                ? \sprintf(
                    'form-data; name="%s"; filename="%s"',
                    $name,
                    self::basename($filename)
                )
                : "form-data; name=\"{$name}\"";
        }

        // Set a default content-length header if one was no provided
        $length = $this->getHeader($headers, 'content-length');

        if (! $length) {
            if ($length = $stream->getSize()) {
                $headers['Content-Length'] = (string) $length;
            }
        }

        // Set a default Content-Type if one was not supplied
        $type = $this->getHeader($headers, 'content-type');

        if (! $type && ($filename === '0' || $filename)) {
            if ($type = MimeType::guess($filename)) {
                $headers['Content-Type'] = $type;
            }
        }

        return [$stream, $headers];
    }
@param string                            $name
@param \Psr\Http\Message\StreamInterface $stream
@param null|string                       $filename
@param array                             $headers

@return array