MediaWiki  master
GuzzleHttp\Psr7\Request\WebRequestUpload Class Reference

Object to access the $_FILES array. More...

Inheritance diagram for GuzzleHttp\Psr7\Request\WebRequestUpload:
Collaboration diagram for GuzzleHttp\Psr7\Request\WebRequestUpload:

Public Member Functions

 __construct ( $request, $key)
 Constructor. More...
 
 exists ()
 Return whether a file with this name was uploaded. More...
 
 getError ()
 Return the upload error. More...
 
 getName ()
 Return the original filename of the uploaded file. More...
 
 getSize ()
 Return the file size of the uploaded file. More...
 
 getTempName ()
 Return the path to the temporary file. More...
 
 getType ()
 Return the client specified content type. More...
 
 isIniSizeOverflow ()
 Returns whether this upload failed because of overflow of a maximum set in php.ini. More...
 

Public Attributes

const REQUIRED_FILEINFO_KEYS = [ 'name', 'size', 'tmp_name', 'type', 'error', ]
 All keys a fileinfo has to specific to work with this class. More...
 

Protected Attributes

bool $doesExist
 
array null $fileInfo
 
WebRequest $request
 

Detailed Description

Object to access the $_FILES array.

Definition at line 37 of file WebRequestUpload.php.

Constructor & Destructor Documentation

◆ __construct()

GuzzleHttp\Psr7\Request\WebRequestUpload::__construct (   $request,
  $key 
)

Constructor.

Should only be called by WebRequest

Parameters
WebRequest$requestThe associated request
string$keyKey in $_FILES array (name of form field)

Definition at line 53 of file WebRequestUpload.php.

References GuzzleHttp\Psr7\Request\WebRequestUpload\$request.

Member Function Documentation

◆ exists()

◆ getError()

GuzzleHttp\Psr7\Request\WebRequestUpload::getError ( )

Return the upload error.

See link for explanation https://www.php.net/manual/en/features.file-upload.errors.php

Returns
int One of the UPLOAD_ constants, 0 if non-existent

Definition at line 141 of file WebRequestUpload.php.

References GuzzleHttp\Psr7\Request\WebRequestUpload\exists().

Referenced by GuzzleHttp\Psr7\Request\WebRequestUpload\isIniSizeOverflow().

◆ getName()

GuzzleHttp\Psr7\Request\WebRequestUpload::getName ( )

Return the original filename of the uploaded file.

Returns
string|null Filename or null if non-existent

Definition at line 75 of file WebRequestUpload.php.

References Sanitizer\decodeCharReferences(), GuzzleHttp\Psr7\Request\WebRequestUpload\exists(), MediaWiki\MediaWikiServices\getInstance(), and wfDebug().

◆ getSize()

GuzzleHttp\Psr7\Request\WebRequestUpload::getSize ( )

Return the file size of the uploaded file.

Returns
int File size or zero if non-existent

Definition at line 97 of file WebRequestUpload.php.

References GuzzleHttp\Psr7\Request\WebRequestUpload\exists().

◆ getTempName()

GuzzleHttp\Psr7\Request\WebRequestUpload::getTempName ( )

Return the path to the temporary file.

Returns
string|null Path or null if non-existent

Definition at line 111 of file WebRequestUpload.php.

References GuzzleHttp\Psr7\Request\WebRequestUpload\exists().

◆ getType()

GuzzleHttp\Psr7\Request\WebRequestUpload::getType ( )

Return the client specified content type.

Returns
string|null Type or null if non-existent
Since
1.35

Definition at line 126 of file WebRequestUpload.php.

References GuzzleHttp\Psr7\Request\WebRequestUpload\exists().

◆ isIniSizeOverflow()

GuzzleHttp\Psr7\Request\WebRequestUpload::isIniSizeOverflow ( )

Returns whether this upload failed because of overflow of a maximum set in php.ini.

Returns
bool

Definition at line 156 of file WebRequestUpload.php.

References GuzzleHttp\Psr7\Request\WebRequestUpload\getError(), and wfShorthandToInteger().

Member Data Documentation

◆ $doesExist

bool GuzzleHttp\Psr7\Request\WebRequestUpload::$doesExist
protected

◆ $fileInfo

array null GuzzleHttp\Psr7\Request\WebRequestUpload::$fileInfo
protected

Definition at line 45 of file WebRequestUpload.php.

◆ $request

WebRequest GuzzleHttp\Psr7\Request\WebRequestUpload::$request
protected

◆ REQUIRED_FILEINFO_KEYS

const GuzzleHttp\Psr7\Request\WebRequestUpload::REQUIRED_FILEINFO_KEYS = [ 'name', 'size', 'tmp_name', 'type', 'error', ]

All keys a fileinfo has to specific to work with this class.

Definition at line 39 of file WebRequestUpload.php.

Referenced by GuzzleHttp\Psr7\Request\FauxRequest\setUpload().


The documentation for this class was generated from the following file: