src/PHPDish/Component/Media/Manager/FileManager.php
public function upload(FileInterface $file, $overwrite = true)
    {
        $body = $file->getContent();
        if ($body instanceof StreamInterface) { //流式写入
            $this->assertStreamingSupport(); //不支持流式读写抛出异常
            $stream = $this->filesystem->createStream($file->getKey());
            $stream->open(new StreamMode('w+'));
            while (!$body->eof()) {
                $stream->write($body->read(1024));
            }
            $stream->close(); //close the stream
        } else {
            $this->filesystem->write($file->getKey(), $body, $overwrite);
        }
    }
public function upload(FileInterface $file, $overwrite = true)
    {
        $body = $file->getContent();
        if ($body instanceof StreamInterface) { //流式写入
            $this->assertStreamingSupport(); //不支持流式读写抛出异常
            $stream = $this->filesystem->createStream($file->getKey());
            $stream->open(new StreamMode('w+'));
            while (!$body->eof()) {
                $stream->write($body->read(1024));
            }
            $stream->close(); //close the stream
        } else {
            $this->filesystem->write($file->getKey(), $body, $overwrite);
        }
    }
{@inheritdoc}