public function setFile($file, $contentDisposition = null, $etag = false, $lastModified = true)
	{
		if (!$file instanceof File) {
			if ($file instanceof \SplFileInfo) {
				$file = new File($file->getPathname());
			} else {
				$file = new File((string) $file);
			}
		}

		if (!$file->isReadable()) {
			throw new FileException('File must be readable.');
		}

		$this->file = $file;

		if ($etag === true)
			$this->setAutoEtag();
		elseif (!empty($etag))
			$this->setEtag($etag);

		if ($lastModified === true)
			$this->setAutoLastModified();
		elseif (!empty($lastModified))
		{
			is_numeric($lastModified) && $lastModified = '@'.$lastModified;
			$this->setLastModified(new \DateTime($lastModified));
		}

		if ($contentDisposition)
			$this->setContentDisposition($contentDisposition);


		return $this;
	}
public function setFile($file, $contentDisposition = null, $etag = false, $lastModified = true)
	{
		if (!$file instanceof File) {
			if ($file instanceof \SplFileInfo) {
				$file = new File($file->getPathname());
			} else {
				$file = new File((string) $file);
			}
		}

		if (!$file->isReadable()) {
			throw new FileException('File must be readable.');
		}

		$this->file = $file;

		if ($etag === true)
			$this->setAutoEtag();
		elseif (!empty($etag))
			$this->setEtag($etag);

		if ($lastModified === true)
			$this->setAutoLastModified();
		elseif (!empty($lastModified))
		{
			is_numeric($lastModified) && $lastModified = '@'.$lastModified;
			$this->setLastModified(new \DateTime($lastModified));
		}

		if ($contentDisposition)
			$this->setContentDisposition($contentDisposition);


		return $this;
	}
public function setFile ( $ file , $ contentDisposition = null , $ etag = false , $ lastModified = true ) { if ( ! $ file instanceof File ) { if ( $ file instanceof \ SplFileInfo ) { $ file = new File ( $ file -> getPathname ( ) ) ; } else { $ file = new File ( ( string ) $ file ) ; } } if ( ! $ file -> isReadable ( ) ) { throw new FileException ( 'File must be readable.' ) ; } $ this -> file = $ file ; if ( $ etag === true ) $ this -> setAutoEtag ( ) ; elseif ( ! empty ( $ etag ) ) $ this -> setEtag ( $ etag ) ; if ( $ lastModified === true ) $ this -> setAutoLastModified ( ) ; elseif ( ! empty ( $ lastModified ) ) { is_numeric ( $ lastModified ) && $ lastModified = '@' . $ lastModified ; $ this -> setLastModified ( new \ DateTime ( $ lastModified ) ) ; } if ( $ contentDisposition ) $ this -> setContentDisposition ( $ contentDisposition ) ; return $ this ; }
Sets the file to stream.

@param \SplFileInfo|string $file               The file to stream
@param string              $contentDisposition
@param bool                $autoEtag
@param bool                $autoLastModified

@return BinaryFileResponse

@throws FileException
Sets the file to stream .