Upload-Interop is based on research including the following projects:
- aura/web (aura)
- Cake 2 CakeRequest (cake2)
- Code Igniter 3 Ci_Upload (ci3)
- flightphp/core (flight)
- horde/controller (horde)
- joomla/input (joomla)
- Klein (klein)
- Lithium (lithium)
- MediaWiki (mediawiki)
- nette/http (nette)
- Phalcon (phalcon)
- psr/http-message (psr)
- symfony/http-foundation (symfony)
- tempestphp/tempest-framework (tempest)
- yiisoft/yii2-dev (yii2)
The projects offer varying levels of mutability:
| Readonly | Mutable | Immutable | |
|---|---|---|---|
| aura | x | ||
| cake2 | x | ||
| ci3 | x | ||
| flight | x | ||
| horde | x | ||
| joomla | x | ||
| klein | x | ||
| lithium | x | ||
| mediawiki | x | ||
| nette | x | ||
| phalcon | x | ||
| psr | x (1) | ||
| symfony | x | ||
| tempest | x | ||
| yii2 | x |
(1) PSR-7 UploadedFileInterface is only quasi-immutable, as it encapsulates a mutable stream.
Most of the projects retain the $_FILES values as an array, and provide access under the native $_FILES array keys (tmp_name, full_path etc.). However, some of the project provide access using public properties or getter methods:
| Native Keys | Public Properties | Getter Methods | |
|---|---|---|---|
| aura | x | ||
| cake2 | x | ||
| ci3 | x | ||
| flight | x | ||
| horde | x | ||
| joomla | x | ||
| klein | x | ||
| lithium | x | ||
| mediawiki | x | ||
| nette | x | ||
| phalcon | x | ||
| psr | x | ||
| symfony | x | ||
| tempest | |||
| yii2 | x |
The projects not using native keys use these properties and methods:
tmp_name |
error |
name |
full_path |
type |
size |
|
|---|---|---|---|---|---|---|
| ci3 | $file_temp |
$error_msg |
$file_name |
$upload_path |
$file_type |
$file_size |
| flight | getTempName() |
getError() |
getClientFilename() |
- | getClientMediaType() |
getSize() |
| nette | getTemporaryFile() |
getError() |
getUntrustedName() |
getUntrustedFullPath() |
getContentType() |
getSize() |
| phalcon | getTempName() |
- | getName() |
- | getType() |
`getSize() |
| psr | via getStream() |
getError() |
getClientFilename() |
- | getClientMediaType() |
getSize() |
| symfony | getPathName() |
getError() |
getClientOriginalName() |
getClientOriginalPath() |
getClientMimeType() |
getSize() |
| tempest | via getStream() |
getError() |
getClientFilename() |
- | getClientMediaType() |
getSize() |
| yii2 | $tempName |
$error |
$name |
$fullPath |
$type |
$size |
Note that projects marked with - do not offer a value for the relevant $_FILES key.
Some projects retain the $_FILES array as given by PHP, while others normalize or rearrange the retained array to make it look more like $_POST.
| Normalizes structure | |
|---|---|
| aura | x |
| cake2 | x |
| ci3 | |
| flight | x |
| horde | |
| joomla | |
| klein | |
| lithium | x |
| mediawiki | |
| nette | x |
| phalcon | x |
| psr | x |
| symfony | x |
| tempest | x |
| yii2 | x |
These projects provide a method to read the body content of the uploaded file:
| Read Body Content | |
|---|---|
| aura | |
| cake2 | |
| ci3 | |
| flight | |
| horde | |
| joomla | |
| klein | |
| lithium | |
| mediawiki | |
| nette | getContents() : string |
| phalcon | |
| psr | via getStream() (1) |
| symfony | getContent() : string |
| tempest | via getStream() (1) |
| yii2 |
(1) Tempest and PSR-7 getStream() return a StreamInterface, on which the getContents() method can be called.
These projects provide a method to move, copy, or rename the uploaded file:
| Move/Copy/Rename Uploaded File | |
|---|---|
| aura | |
| cake2 | |
| ci3 | do_upload() |
| flight | moveTo(string $targetPath) : void |
| horde | |
| joomla | |
| klein | |
| lithium | |
| mediawiki | |
| nette | move(string $dest) : $this |
| phalcon | moveTo(string $destination) : bool |
| psr | moveTo(string $dest) : void |
| symfony | move(string $directory, ?string $name = null) : File |
| tempest | moveTo(string $targetPath) : void |
| yii2 | saveAs($file, $deleteTempFile = true) : bool |