MediaWiki  master
WebRequestUpload Class Reference

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

Collaboration diagram for 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...
 

Protected Attributes

bool $doesExist
 
array null $fileInfo
 
WebRequest $request
 

Detailed Description

Object to access the $_FILES array.

Definition at line 33 of file WebRequestUpload.php.

Constructor & Destructor Documentation

◆ __construct()

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 47 of file WebRequestUpload.php.

References $request.

Member Function Documentation

◆ exists()

WebRequestUpload::exists ( )

Return whether a file with this name was uploaded.

Returns
bool

Definition at line 60 of file WebRequestUpload.php.

References $doesExist.

Referenced by getError(), getName(), getSize(), getTempName(), and getType().

◆ getError()

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 135 of file WebRequestUpload.php.

References exists().

Referenced by isIniSizeOverflow().

◆ getName()

WebRequestUpload::getName ( )

Return the original filename of the uploaded file.

Returns
string|null Filename or null if non-existent

Definition at line 69 of file WebRequestUpload.php.

References Sanitizer\decodeCharReferences(), exists(), and wfDebug().

◆ getSize()

WebRequestUpload::getSize ( )

Return the file size of the uploaded file.

Returns
int File size or zero if non-existent

Definition at line 91 of file WebRequestUpload.php.

References exists().

◆ getTempName()

WebRequestUpload::getTempName ( )

Return the path to the temporary file.

Returns
string|null Path or null if non-existent

Definition at line 105 of file WebRequestUpload.php.

References exists().

◆ getType()

WebRequestUpload::getType ( )

Return the client specified content type.

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

Definition at line 120 of file WebRequestUpload.php.

References exists().

◆ isIniSizeOverflow()

WebRequestUpload::isIniSizeOverflow ( )

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

Returns
bool

Definition at line 150 of file WebRequestUpload.php.

References getError(), and wfShorthandToInteger().

Member Data Documentation

◆ $doesExist

bool WebRequestUpload::$doesExist
protected

Definition at line 37 of file WebRequestUpload.php.

Referenced by exists().

◆ $fileInfo

array null WebRequestUpload::$fileInfo
protected

Definition at line 39 of file WebRequestUpload.php.

◆ $request

WebRequest WebRequestUpload::$request
protected

Definition at line 35 of file WebRequestUpload.php.

Referenced by __construct().


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