Go to the documentation of this file.
43 $this->doesExist = isset( $_FILES[$key] );
44 if ( $this->doesExist ) {
45 $this->fileInfo = $_FILES[$key];
68 $name = $this->fileInfo[
'name'];
70 # Safari sends filenames in HTML-encoded Unicode form D...
71 # Horrid and evil! Let's try to make some kind of sense of it.
72 $name = Sanitizer::decodeCharReferences( $name );
73 $name = MediaWikiServices::getInstance()->getContentLanguage()->normalize( $name );
74 wfDebug( __METHOD__ .
": {$this->fileInfo['name']} normalized to '$name'\n" );
88 return $this->fileInfo[
'size'];
101 return $this->fileInfo[
'tmp_name'];
112 return 0; # UPLOAD_ERR_OK
115 return $this->fileInfo[
'error'];
125 if ( $this->
getError() == UPLOAD_ERR_INI_SIZE ) {
126 # PHP indicated that upload_max_filesize is exceeded
130 $contentLength = $this->request->getHeader(
'Content-Length' );
132 ini_get(
'post_max_size' ) ?: ini_get(
'hhvm.server.max_post_size' ),
136 if ( $maxPostSize && $contentLength > $maxPostSize ) {
137 # post_max_size is exceeded
getError()
Return the upload error.
__construct( $request, $key)
Constructor.
isIniSizeOverflow()
Returns whether this upload failed because of overflow of a maximum set in php.ini.
exists()
Return whether a file with this name was uploaded.
getName()
Return the original filename of the uploaded file.
Object to access the $_FILES array.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
getTempName()
Return the path to the temporary file.
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
getSize()
Return the file size of the uploaded file.