FileUploader
Table of Contents
Constants
- MODULE_ID = "transformer"
- MODULE_PATH = "transformer"
Methods
- getFullPath() : string
- Finds upload directory and adds to it directory of the module.
- getUploadInfo() : array<string|int, mixed>
- Get information about uploading of the particular file.
- isCorrectFile() : bool
- saveUploadedPart() : Result
- Try to upload file. If bucket ID is set, try to cloud. Otherwise upload it local.
Constants
MODULE_ID
public
mixed
MODULE_ID
= "transformer"
MODULE_PATH
public
mixed
MODULE_PATH
= "transformer"
Methods
getFullPath()
Finds upload directory and adds to it directory of the module.
public
static getFullPath(string $fileName) : string
Parameters
- $fileName : string
-
Basename of the file.
Return values
stringgetUploadInfo()
Get information about uploading of the particular file.
public
static getUploadInfo(int $commandId, string $fileKey, int $fileSize) : array<string|int, mixed>
If it can be uploaded to a cloud - get bucket id and chunk.
Parameters
- $commandId : int
-
ID of the command.
- $fileKey : string
-
Extension of the file.
- $fileSize : int
-
Full size of the file.
Return values
array<string|int, mixed>isCorrectFile()
public
static isCorrectFile(File $file) : bool
Parameters
- $file : File
Return values
boolsaveUploadedPart()
Try to upload file. If bucket ID is set, try to cloud. Otherwise upload it local.
public
static saveUploadedPart(string $fileName, string $data, int $fileSize, bool $isLastPart[, int $bucket = 0 ]) : Result
Parameters
- $fileName : string
-
Relative path to the file.
- $data : string
-
Content to save.
- $fileSize : int
-
Full size of the file.
- $isLastPart : bool
-
Is it last part of the file.
- $bucket : int = 0
-
Id of the cloud bucket.