File
Table of Contents
- MIME_TYPES = ['application/pdf' => 'pdf']
- $dirname : string
- $extension : string
- $mimeType : string
- $path : string
- $uploadName : string
- $filename : string
- __construct() : mixed
- clone() : File
- Clone file
- copy() : File
- Copy file to destination
- delete() : void
- Delete file
- getBasename() : string
- Returns basename
- getDirname() : string
- Returns directory
- getFilename() : string
- Returns filename
- getMimeType() : string
- Return file mime type
- getPath() : string
- Returns path
- getUploadName() : string|null
- Returns upload name
- isImage() : bool
- Checks if file is image
- move() : self
- Moves file to new location
- rename() : self
- Rename file
- setExtension() : self
- Set file extension
- setUploadName() : self
- Sets upload name
- toImage() : Image
- Creates image from file
- setMimeType() : self
- Sets mime type
- setPath() : self
- Sets file path
- mimeTypeToExtension() : string
- Mime to extension
- setPermitions() : self
- Sets file permitions
Constants
MIME_TYPES
public
array<string|int, string>
MIME_TYPES
= ['application/pdf' => 'pdf']
Properties
$dirname
protected
string
$dirname
$extension
protected
string
$extension
$mimeType
protected
string
$mimeType
$path
protected
string
$path
$uploadName
protected
string
$uploadName
$filename
private
string
$filename
Methods
__construct()
public
__construct(string $path) : mixed
Parameters
- $path : string
Return values
mixed —clone()
Clone file
public
clone() : File
Return values
File —copy()
Copy file to destination
public
copy(string $destination) : File
Parameters
- $destination : string
Return values
File —delete()
Delete file
public
delete() : void
Return values
void —getBasename()
Returns basename
public
getBasename() : string
Return values
string —getDirname()
Returns directory
public
getDirname() : string
Return values
string —getFilename()
Returns filename
public
getFilename() : string
Return values
string —getMimeType()
Return file mime type
public
getMimeType() : string
Return values
string —getPath()
Returns path
public
getPath() : string
Return values
string —getUploadName()
Returns upload name
public
getUploadName() : string|null
Return values
string|null —isImage()
Checks if file is image
public
isImage() : bool
Return values
bool —move()
Moves file to new location
public
move(string $destination) : self
Parameters
- $destination : string
Return values
self —rename()
Rename file
public
rename(string $filename) : self
Parameters
- $filename : string
Return values
self —setExtension()
Set file extension
public
setExtension(string $extension) : self
Parameters
- $extension : string
Return values
self —setUploadName()
Sets upload name
public
setUploadName(string $name) : self
Parameters
- $name : string
Return values
self —toImage()
Creates image from file
public
toImage() : Image
Return values
Image —setMimeType()
Sets mime type
protected
setMimeType() : self
Return values
self —setPath()
Sets file path
protected
setPath(string $path) : self
Parameters
- $path : string
Return values
self —mimeTypeToExtension()
Mime to extension
private
mimeTypeToExtension(string $mime) : string
Parameters
- $mime : string
Return values
string —setPermitions()
Sets file permitions
private
setPermitions(int $permitions) : self
Parameters
- $permitions : int