FileComponent
extends Injectable
in package
Table of Contents
Properties
- $destination : string
- Destination path.
- $file : string|File
- File.
- $filename : string
- Filename.
- $mimeType : string
- MIME-type.
- $target : string
- Target path.
Methods
- download() : mixed
- Download a file.
- getFilename() : string
- Get the fileName.
- getMime() : string
- Get MIME-type.
- getPath() : mixed
- getTarget() : string
- Get target.
- isExists() : mixed
- parseMime() : string
- Parse file MIME-type.
- remove() : bool
- Remove attachment.
- setFile() : FileComponent
- Set the file.
- setFilename() : FileComponent
- Set the fileName.
- setMime() : FileComponent
- Set MIME-type.
- setTarget() : FileComponent
- Set target path.
- upload() : bool|string
- Upload attachment.
- clearDirectory() : mixed
- Clear the given directory, if it is empty.
- createDirectories() : mixed
- Create target and destination directories,<br> if they are not directories.
Properties
$destination
Destination path.
protected
string
$destination
$file
File.
protected
string|File
$file
$filename
Filename.
protected
string
$filename
$mimeType
MIME-type.
protected
string
$mimeType
= 'text/plain'
$target
Target path.
protected
string
$target
= ''
Methods
download()
Download a file.
public
download([string $alias = null ][, bool $deleteAfter = false ]) : mixed
Parameters
- $alias : string = null
-
File alias name
- $deleteAfter : bool = false
-
Delete after download
Tags
getFilename()
Get the fileName.
public
getFilename() : string
Return values
stringgetMime()
Get MIME-type.
public
getMime() : string
Return values
stringgetPath()
public
getPath() : mixed
getTarget()
Get target.
public
getTarget() : string
Return values
stringisExists()
public
isExists() : mixed
parseMime()
Parse file MIME-type.
public
parseMime(string $filename) : string
Parameters
- $filename : string
Return values
stringremove()
Remove attachment.
public
remove() : bool
Tags
Return values
boolsetFile()
Set the file.
public
setFile(string $file) : FileComponent
Parameters
- $file : string
-
Name of the file
Return values
FileComponentsetFilename()
Set the fileName.
public
setFilename(string $filename) : FileComponent
Parameters
- $filename : string
-
Name of the file
Return values
FileComponentsetMime()
Set MIME-type.
public
setMime(string $mime) : FileComponent
Parameters
- $mime : string
-
MIME-type of the file
Return values
FileComponentsetTarget()
Set target path.
public
setTarget(string $path) : FileComponent
Parameters
- $path : string
-
Target path
Return values
FileComponentupload()
Upload attachment.
public
upload() : bool|string
Tags
Return values
bool|stringclearDirectory()
Clear the given directory, if it is empty.
private
clearDirectory(string $directory) : mixed
Parameters
- $directory : string
-
Path of directory
createDirectories()
Create target and destination directories,<br> if they are not directories.
private
createDirectories() : mixed