IUpload

Interface for an uploaded file item.
Source
IUpload.php
Extends
IteratorAggregate
Implementations
Upload

Methods

__construct

IUpload $obj = new IUpload()

Crates Upload instance. Loads data from $_FILES.

Returns

void

get

IUploadedFile|array $obj->get(string key)

Get the uploaded file object ("IUploadedFile" instance) mapped to the key or return all of the uploaded file objects ("IUploadedFile" instances) if key is not passed.

Arguments

    key (string)
    Key to an uploaded file, if there are a series of keys then use "." between the keys e.g. "file.1.2" of "file[1][2]", if nothing is passed the files will be returned as [key: UploadedFile-instance,]

Returns

IUploadedFile|array
The uploaded file object mapped to the key or the whole array or uploaded file objects

getFiles

array $obj->getFiles([string] keys)

Get info about uploaded file(s). The file structure is the same as the file input names e.g. name="file[pic][1][2]" : {file: {1: {2: UploadedFile-instance,},},}

Arguments

    keys ([string])
    Key or a series of keys to an uploaded file, e.g. passing arguments as "file", "pic", 1, 2 would return the "upload-info" if nothing is passed the whole files upload-info array will be returned

Returns

array
the array set the key or a series of keys or null=if key not exists,

has

bool $obj->has(key string)

Check if a file upload key exists.

Arguments

    string (key)
    Key to be checked

Returns

bool
true=key exists