\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, boolean  $checkPath = true) 

Constructs a new file from the given path.

Parameters

string $path

The path to the file

boolean $checkPath

Whether to check the path or not

Throws

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

If the given path is not a file

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 —

The guessed extension or null if it cannot be guessed

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 —

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

move()

move(\Symfony\Component\HttpFoundation\File\string  $directory, \Symfony\Component\HttpFoundation\File\string  $name = null) : self

Moves the file to a new location.

Parameters

\Symfony\Component\HttpFoundation\File\string $directory
\Symfony\Component\HttpFoundation\File\string $name

Throws

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

if the target file could not be created

Returns

self —

A File object representing the new file

getContent()

getContent() 

getSize()

getSize() 

{@inheritdoc}

getTargetFile()

getTargetFile(\Symfony\Component\HttpFoundation\File\string  $directory, \Symfony\Component\HttpFoundation\File\string  $name = null) : self

Parameters

\Symfony\Component\HttpFoundation\File\string $directory
\Symfony\Component\HttpFoundation\File\string $name

Returns

self

getName()

getName(\Symfony\Component\HttpFoundation\File\string  $name) : string

Returns locale independent base name of the given path.

Parameters

\Symfony\Component\HttpFoundation\File\string $name

Returns

string