class Stream extends File

A PHP stream of unknown size.

Methods

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

Constructs a new file from the given path.

from File
string|null
guessExtension()

Returns the extension based on the mime type.

from File
string|null
getMimeType()

Returns the mime type of the file.

from File
move(string $directory, string $name = null)

Moves the file to a new location.

from File
getTargetFile($directory, $name = null)

No description

from File
string
getName(string $name)

Returns locale independent base name of the given path.

from File
getSize()

{@inheritdoc}

Details

in File at line 34
__construct(string $path, bool $checkPath = true)

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

Exceptions

FileNotFoundException If the given path is not a file

in File at line 56
string|null guessExtension()

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.

Return Value

string|null The guessed extension or null if it cannot be guessed

See also

ExtensionGuesser
getMimeType()

in File at line 75
string|null getMimeType()

Returns the mime type of the file.

The mime type is guessed using a MimeTypeGuesser instance, which uses finfo(), mime_content_type() and the system binary "file" (in this order), depending on which of those are available.

Return Value

string|null The guessed mime type (e.g. "application/pdf")

See also

MimeTypeGuesser

in File at line 92
File move(string $directory, string $name = null)

Moves the file to a new location.

Parameters

string $directory The destination folder
string $name The new file name

Return Value

File A File object representing the new file

Exceptions

FileException if the target file could not be created

in File at line 108
protected getTargetFile($directory, $name = null)

Parameters

$directory
$name

in File at line 130
protected string getName(string $name)

Returns locale independent base name of the given path.

Parameters

string $name The new file name

Return Value

string containing

at line 24
getSize()

{@inheritdoc}