public function setContent($content)
    {
        if (is_resource($content) && get_resource_type($content) === 'stream' && stream_is_local($content)) {
            $streamMetaData = stream_get_meta_data($content);
            $this->headers->set('Content-Length', filesize($streamMetaData['uri']));
            $this->headers->set('Content-Type', MediaTypes::getMediaTypeFromFilename($streamMetaData['uri']));
        }

        parent::setContent($content);
    }
public function setContent($content)
    {
        if (is_resource($content) && get_resource_type($content) === 'stream' && stream_is_local($content)) {
            $streamMetaData = stream_get_meta_data($content);
            $this->headers->set('Content-Length', filesize($streamMetaData['uri']));
            $this->headers->set('Content-Type', MediaTypes::getMediaTypeFromFilename($streamMetaData['uri']));
        }

        parent::setContent($content);
    }
public function setContent ( $ content ) { if ( is_resource ( $ content ) && get_resource_type ( $ content ) === 'stream' && stream_is_local ( $ content ) ) { $ streamMetaData = stream_get_meta_data ( $ content ) ; $ this -> headers -> set ( 'Content-Length' , filesize ( $ streamMetaData [ 'uri' ] ) ) ; $ this -> headers -> set ( 'Content-Type' , MediaTypes :: getMediaTypeFromFilename ( $ streamMetaData [ 'uri' ] ) ) ; } parent :: setContent ( $ content ) ; }
Explicitly sets the content of the request body

In most cases, content is just a string representation of the request body.
In order to reduce memory consumption for uploads and other big data, it is
also possible to pass a stream resource. The easies way to convert a local file
into a stream resource is probably: $resource = fopen('file://path/to/file', 'rb');

@param string|resource $content The body content, for example arguments of a PUT request, or a stream resource
@return void
@deprecated Since Flow 5.1, use withBody
@see withBody()
Explicitly sets the content of the request body