MetaFox

UploadFile
in package
implements UploadFile

Class UploadFile.

Tags
SuppressWarnings

(PHPMD.CouplingBetweenObjects)

SuppressWarnings

(PHPMD.ExcessiveClassComplexity)

Table of Contents

Interfaces

UploadFile

Properties

$base64  : string|null
$itemType  : string|null
$options  : array<string|int, mixed>|array<string|int, string>
$path  : string
$resizeImage  : ResizeImageInterface
$storageId  : string
$user  : User|null

Methods

__construct()  : mixed
asUploadedFile()  : UploadedFile
Convert local file path to uploaded file.
convertBase64ToUploadedFile()  : UploadedFile
convertFile()  : UploadedFile|null
convertImageToBase64()  : string
getBase64()  : string|null
getFile()  : StorageFile
getFileId()  : int|null
getResizeImage()  : ResizeImageInterface
getStorage()  : string
Get storage server id.
isImage()  : bool
pathToUploadedFile()  : UploadedFile
rollUp()  : bool
setBase64()  : $this
setItemType()  : UploadFile
setPath()  : static
setStorage()  : $this
Where to storage file etc.
setThumbSizes()  : self
Thumb sizes configure at "./config/image.php".
setUser()  : $this
storeAttachment()  : Attachment
storeAttachments()  : array<string|int, Attachment>
storeFile()  : StorageFile
storeFiles()  : array<string|int, StorageFile>
uploadWithParams()  : StorageFile
getConverter()  : FileConverterInterface|null
handleBase64()  : string|null
getFileName()  : string
Generate file name.

Properties

$options

private array<string|int, mixed>|array<string|int, string> $options = ['visibility' => 'public']

Methods

asUploadedFile()

Convert local file path to uploaded file.

public asUploadedFile(string $realpath[, mixed $originalName = null ][, bool $testMode = false ]) : UploadedFile
Parameters
$realpath : string
$originalName : mixed = null
$testMode : bool = false
Return values
UploadedFile

convertBase64ToUploadedFile()

public convertBase64ToUploadedFile(string $imageBase64) : UploadedFile
Parameters
$imageBase64 : string
Return values
UploadedFile

convertFile()

public convertFile(UploadedFile $file) : UploadedFile|null
Parameters
$file : UploadedFile
Tags
inheritDoc
Return values
UploadedFile|null

convertImageToBase64()

public convertImageToBase64(string $realpath) : string
Parameters
$realpath : string
Return values
string

getBase64()

public getBase64() : string|null
Return values
string|null

getFileId()

public getFileId(int|null $tempFileId[, bool $rollUp = false ]) : int|null
Parameters
$tempFileId : int|null
$rollUp : bool = false
Return values
int|null

getStorage()

Get storage server id.

public getStorage() : string
Return values
string

isImage()

public isImage(UploadedFile $file) : bool
Parameters
$file : UploadedFile
Return values
bool

pathToUploadedFile()

public static pathToUploadedFile(string $realpath[, string $newFileName = null ][, bool $isTestMode = true ]) : UploadedFile
Parameters
$realpath : string
$newFileName : string = null
$isTestMode : bool = true
Tags
inheritdoc
SuppressWarnings

(PHPMD.BooleanArgumentFlag)

Return values
UploadedFile

rollUp()

public rollUp(int $id) : bool
Parameters
$id : int
Return values
bool

setBase64()

public setBase64(string|null $base64) : $this
Parameters
$base64 : string|null
Return values
$this

setPath()

public setPath(string $path) : static
Parameters
$path : string
Return values
static

setStorage()

Where to storage file etc.

public setStorage(mixed $storageId) : $this
Parameters
$storageId : mixed

Example: "photo", "video", "temporary", "attachment"

Return values
$this

setThumbSizes()

Thumb sizes configure at "./config/image.php".

public setThumbSizes(array<string|int, int> $sizes) : self
Parameters
$sizes : array<string|int, int>
Return values
self

setUser()

public setUser(User|null $user) : $this
Parameters
$user : User|null
Return values
$this

storeAttachments()

public storeAttachments(array<string|int, mixed> $files) : array<string|int, Attachment>
Parameters
$files : array<string|int, mixed>
Return values
array<string|int, Attachment>

storeFiles()

public storeFiles(array<string|int, mixed> $files) : array<string|int, StorageFile>
Parameters
$files : array<string|int, mixed>
Return values
array<string|int, StorageFile>

uploadWithParams()

public uploadWithParams(UploadedFile $file[, array<string|int, mixed> $params = [] ]) : StorageFile
Parameters
$file : UploadedFile
$params : array<string|int, mixed> = []
Tags
inheritDoc
Return values
StorageFile

handleBase64()

protected handleBase64(UploadedFile $uploadedFile) : string|null
Parameters
$uploadedFile : UploadedFile
Return values
string|null

getFileName()

Generate file name.

private getFileName(UploadedFile $file) : string
Parameters
$file : UploadedFile
Return values
string

        
On this page

Search results