file

package

KCFinder @version 3.12 @author Pavel Tzonkov sunhater@sunhater.com

Methods

Get the extension from filename

getExtension(string $filename,boolean $toLower = true): string
static

Arguments

$filename

string

$toLower

boolean

Response

string

Get inexistant filename based on the given filename. If you skip $dir parameter the directory will be fetched from $filename and returned value will be full filename path. The third parameter is optional and defines the template, the filename will be renamed to. Default template is {name}({sufix}){ext}. Examples:

getInexistantFilename(string $filename,string $dir = null,string $tpl = null): string
static

file::getInexistantFilename("/my/directory/myfile.txt"); If myfile.txt does not exist - returns the same path to the file otherwise returns "/my/directory/myfile(1).txt"

file::getInexistantFilename("myfile.txt", "/my/directory"); returns "myfile.txt" or "myfile(1).txt" or "myfile(2).txt" etc...

file::getInexistantFilename("myfile.txt", "/dir", "{name}[{sufix}]{ext}"); returns "myfile.txt" or "myfile[1].txt" or "myfile[2].txt" etc...

Arguments

$filename

string

$dir

string

$tpl

string

Response

string

Get MIME type of the given filename. If Fileinfo PHP extension is available the MIME type will be fetched by the file's content. The second parameter is optional and defines the magic file path. If you skip it, the default one will be loaded.

getMimeType(string $filename,string $magic = null): string
static

If Fileinfo PHP extension is not available the MIME type will be fetched by filename extension regarding $MIME property. If the file extension does not exist there, returned type will be application/octet-stream

Arguments

$filename

string

$magic

string

Response

string

Checks if the given file is really writable. The standard PHP function is_writable() does not work properly on Windows servers.

isWritable(string $filename): boolean
static

Arguments

$filename

string

Response

boolean

Normalize given filename. Accented characters becomes non-accented and removes any other special characters. Usable for non-unicode filesystems

normalizeFilename( $filename): string
static

Arguments

$filename

Response

string

Properties

MIME

MIME :
static

Type(s)