FileHelper
API reference › yii › helpers › FileHelper
File system helper.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$mimeAliasesFile static | string | The path (or alias) of a PHP file containing MIME aliases. Default: '@yii/helpers/mimeAliases.php'. Available since 2.0.14. | BaseFileHelper |
$mimeExtensionsFile static | string | The path (or alias) of a PHP file containing extensions per MIME type. Default: '@yii/helpers/mimeExtensions.php'. Available since 2.0.48. | BaseFileHelper |
$mimeMagicFile static | string | The path (or alias) of a PHP file containing MIME type information. Default: '@yii/helpers/mimeTypes.php'. | BaseFileHelper |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
changeOwnership() static | Changes the Unix user and/or group ownership of a file or directory, and optionally the mode. | BaseFileHelper |
copyDirectory() static | Copies a whole directory as another one. | BaseFileHelper |
createDirectory() static | Creates a new directory. | BaseFileHelper |
filterPath() static | Checks if the given file path satisfies the filtering options. | BaseFileHelper |
findDirectories() static | Returns the directories found under the specified directory and subdirectories. | BaseFileHelper |
findFiles() static | Returns the files found under the specified directory and subdirectories. | BaseFileHelper |
getExtensionByMimeType() static | Determines the most common extension by given MIME type. | BaseFileHelper |
getExtensionsByMimeType() static | Determines the extensions by given MIME type. | BaseFileHelper |
getMimeType() static | Determines the MIME type of the specified file. | BaseFileHelper |
getMimeTypeByExtension() static | Determines the MIME type based on the extension name of the specified file. | BaseFileHelper |
localize() static | Returns the localized version of a specified file. | BaseFileHelper |
normalizePath() static | Normalizes a file/directory path. | BaseFileHelper |
removeDirectory() static | Removes a directory (and all its content) recursively. | BaseFileHelper |
unlink() static | Removes a file or symlink in a cross-platform way | BaseFileHelper |
loadMimeAliases() protected static | Loads MIME aliases from the specified file. | BaseFileHelper |
loadMimeExtensions() protected static | Loads MIME extensions from the specified file. | BaseFileHelper |
loadMimeTypes() protected static | Loads MIME types from the specified file. | BaseFileHelper |
normalizeOptions() protected static | BaseFileHelper |
Constants
Section titled “Constants”| Constant | Value | Description | Defined by |
|---|---|---|---|
PATTERN_NODIR | 1 | BaseFileHelper | |
PATTERN_ENDSWITH | 4 | BaseFileHelper | |
PATTERN_MUSTBEDIR | 8 | BaseFileHelper | |
PATTERN_NEGATIVE | 16 | BaseFileHelper | |
PATTERN_CASE_INSENSITIVE | 32 | BaseFileHelper |