\Symfony\Component\HttpFoundation\FileStream

A PHP stream of unknown size.

Summary

Methods
Properties
Constants
__construct()
guessExtension()
getMimeType()
move()
getContent()
getSize()
No public properties found
No constants found
getTargetFile()
getName()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct(string  $path, bool  $checkPath = true) : mixed

Constructs a new file from the given path.

Parameters

string $path

The path to the file

bool $checkPath

Whether to check the path or not

Throws

\Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException

If the given path is not a file

Returns

mixed —

guessExtension()

guessExtension() : string|null

Returns the extension based on the mime type.

If the mime type is unknown, returns null.

This method uses the mime type as guessed by getMimeType() to guess the file extension.

Returns

string|null —

getMimeType()

getMimeType() : string|null

Returns the mime type of the file.

The mime type is guessed using a MimeTypeGuesserInterface instance, which uses finfo_file() then the "file" system binary, depending on which of those are available.

Returns

string|null —

move()

move(string  $directory, string  $name = null) : self

Moves the file to a new location.

Parameters

string $directory
string $name

Throws

\Symfony\Component\HttpFoundation\File\Exception\FileException

if the target file could not be created

Returns

self —

getContent()

getContent() : string

Returns

string —

getSize()

getSize() : int|false

{@inheritdoc}

Returns

int|false —

getTargetFile()

getTargetFile(string  $directory, string  $name = null) : self

Parameters

string $directory
string $name

Returns

self —

getName()

getName(string  $name) : string

Returns locale independent base name of the given path.

Parameters

string $name

Returns

string —