\CodeIgniter\HTTP\FilesFileCollection

Class FileCollection

Provides easy access to uploaded files for a request.

Summary

Methods
Properties
Constants
all()
getFile()
getFileMultiple()
hasFile()
No public properties found
No constants found
populateFiles()
createFileObject()
fixFilesArray()
getValueDotNotationSyntax()
$files
N/A
No private methods found
No private properties found
N/A

Properties

$files

$files : array|null

An array of UploadedFile instances for any files uploaded as part of this request.

Populated the first time either files(), file(), or hasFile() is called.

Type

array|null

Methods

all()

all() : array|null

Returns an array of all uploaded files that were found.

Each element in the array will be an instance of UploadedFile. The key of each element will be the client filename.

Returns

array|null

getFile()

getFile(string  $name) : \CodeIgniter\HTTP\Files\UploadedFile|null

Attempts to get a single file from the collection of uploaded files.

Parameters

string $name

Returns

\CodeIgniter\HTTP\Files\UploadedFile|null

getFileMultiple()

getFileMultiple(string  $name) : array|null

Verify if a file exist in the collection of uploaded files and is have been uploaded with multiple option.

Parameters

string $name

Returns

array|null

hasFile()

hasFile(string  $fileID) : boolean

Checks whether an uploaded file with name $fileID exists in this request.

Parameters

string $fileID

The name of the uploaded file (from the input)

Returns

boolean

populateFiles()

populateFiles() 

Taking information from the $_FILES array, it creates an instance of UploadedFile for each one, saving the results to this->files.

Called by files(), file(), and hasFile()

createFileObject()

createFileObject(array  $array) : array|\CodeIgniter\HTTP\Files\UploadedFile

Given a file array, will create UploadedFile instances. Will loop over an array and create objects for each.

Parameters

array $array

Returns

array|\CodeIgniter\HTTP\Files\UploadedFile

fixFilesArray()

fixFilesArray(array  $data) : array

Reformats the odd $_FILES array into something much more like we would expect, with each object having its own array.

Thanks to Jack Sleight on the PHP Manual page for the basis of this method.

Parameters

array $data

Returns

array

getValueDotNotationSyntax()

getValueDotNotationSyntax(array  $index, array  $value) : mixed

Navigate through a array looking for a particular index

Parameters

array $index

The index sequence we are navigating down

array $value

The portion of the array to process

Returns

mixed