51 $this->doesExist = isset( $_FILES[$key] );
52 if ( $this->doesExist ) {
53 $this->fileInfo = $_FILES[$key];
77 $name = $this->fileInfo[
'name'];
79 # Safari sends filenames in HTML-encoded Unicode form D...
80 # Horrid and evil! Let's try to make some kind of sense of it.
81 $name = Sanitizer::decodeCharReferences( $name );
82 $name = MediaWikiServices::getInstance()->getContentLanguage()->normalize( $name );
84 wfDebug( __METHOD__ .
": {$this->fileInfo['name']} normalized to '$name'" );
99 return $this->fileInfo[
'size'];
113 return $this->fileInfo[
'tmp_name'];
128 return $this->fileInfo[
'type'];
139 return 0; # UPLOAD_ERR_OK
143 return $this->fileInfo[
'error'];
153 if ( $this->
getError() == UPLOAD_ERR_INI_SIZE ) {
154 # PHP indicated that upload_max_filesize is exceeded
158 $contentLength = $this->request->getHeader(
'Content-Length' );
161 if ( $maxPostSize && $contentLength > $maxPostSize ) {
162 # post_max_size is exceeded
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfShorthandToInteger(?string $string='', int $default=-1)
Converts shorthand byte notation to integer form.
Object to access the $_FILES array.
getType()
Return the client specified content type.
getError()
Return the upload error.
isIniSizeOverflow()
Returns whether this upload failed because of overflow of a maximum set in php.ini.
const REQUIRED_FILEINFO_KEYS
All keys a fileinfo has to specific to work with this class.
exists()
Return whether a file with this name was uploaded.
__construct( $request, $key)
Constructor.
getSize()
Return the file size of the uploaded file.
getTempName()
Return the path to the temporary file.
getName()
Return the original filename of the uploaded file.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...