PHP Класс Symfony\Component\HttpFoundation\File\File

Автор: Bernhard Schussek ([email protected])
Наследование: extends SplFileInfo
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $path, boolean $checkPath = true ) Constructs a new file from the given path.
getExtension ( ) : string Returns the extension of the file.
getMimeType ( ) : string | null Returns the mime type of the file.
guessExtension ( ) : string | null Returns the extension based on the mime type.
move ( string $directory, string $name = null ) : File Moves the file to a new location.

Описание методов

__construct() публичный Метод

Constructs a new file from the given path.
public __construct ( string $path, boolean $checkPath = true )
$path string The path to the file
$checkPath boolean Whether to check the path or not

getExtension() публичный Метод

\SplFileInfo::getExtension() is not available before PHP 5.3.6
public getExtension ( ) : string
Результат string The extension

getMimeType() публичный Метод

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.
public getMimeType ( ) : string | null
Результат string | null The guessed mime type (i.e. "application/pdf")

guessExtension() публичный Метод

If the mime type is unknown, returns null.
public guessExtension ( ) : string | null
Результат string | null The guessed extension or null if it cannot be guessed

move() публичный Метод

Moves the file to a new location.
public move ( string $directory, string $name = null ) : File
$directory string The destination folder
$name string The new file name
Результат File A File object representing the new file