SymfonyComponentHttpFoundationFileFile

A file in the file system.

Summary

No public properties found
No constants found
No protected properties found
N/A
No private methods found
No private properties found
N/A
File
vendorSymfonyComponentHttpFoundationFileFile.php
Package
Default
Class hierarchy
SplFileInfo
SymfonyComponentHttpFoundationFileFile

Tags

author

Bernhard Schussek bschussek@gmail.com

api

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

SymfonyComponentHttpFoundationFileExceptionFileNotFoundException

If the given path is not a file

Tags

api

guessExtension()

guessExtension() : string|null

Returns the extension based on the mime type.

If the mime type is unknown, returns null.

Returns

string|null —

The guessed extension or null if it cannot be guessed

Tags

api

getMimeType()

getMimeType() : string|null

Returns the mime type of the file.

The mime type is guessed using the functions finfo(), mime_content_type() and the system binary "file" (in this order), depending on which of those is available on the current operating system.

Returns

string|null —

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

Tags

api

getExtension()

getExtension() : string

Returns the extension of the file.

SplFileInfo::getExtension() is not available before PHP 5.3.6

Returns

string —

The extension

Tags

api

move()

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

Moves the file to a new location.

Parameters

string $directory

The destination folder

string $name

The new file name

Throws

SymfonyComponentHttpFoundationFileExceptionFileException

if the target file could not be created

Returns

SymfonyComponentHttpFoundationFileFile

A File object representing the new file

Tags

api

getTargetFile()

getTargetFile(  $directory,   $name = null) 

Parameters

$directory
$name

Tags

None found

getName()

getName(string  $name) : string

Returns locale independent base name of the given path.

Parameters

string $name

The new file name

Returns

string —

containing

Tags

None found