MediaWiki  1.34.0
WebRequestUpload Class Reference

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

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...
 
 isIniSizeOverflow ()
 Returns whether this upload failed because of overflow of a maximum set in php.ini. More...
 

Protected Attributes

 $doesExist
 
 $fileInfo
 
 $request
 

Detailed Description

Object to access the $_FILES array.

Definition at line 30 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 41 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 54 of file WebRequestUpload.php.

References $doesExist.

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

◆ 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 110 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 63 of file WebRequestUpload.php.

References 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 83 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 96 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 124 of file WebRequestUpload.php.

References getError(), and wfShorthandToInteger().

Member Data Documentation

◆ $doesExist

WebRequestUpload::$doesExist
protected

Definition at line 32 of file WebRequestUpload.php.

Referenced by exists().

◆ $fileInfo

WebRequestUpload::$fileInfo
protected

Definition at line 33 of file WebRequestUpload.php.

◆ $request

WebRequestUpload::$request
protected

Definition at line 31 of file WebRequestUpload.php.

Referenced by __construct().


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