ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ILIAS\FileUpload\DTO\Metadata Class Reference

Class Metadata. More...

+ Collaboration diagram for ILIAS\FileUpload\DTO\Metadata:

Public Member Functions

 __construct ($filename, $size, $mimeType)
 Metadata constructor. More...
 
 getFilename ()
 The filename supplied by the browser. More...
 
 setFilename ($filename)
 Overwrite the current filename. More...
 
 getUploadSize ()
 This is always the original file size which was determined by the http service. More...
 
 getMimeType ()
 Client supplied mime type of the uploaded. More...
 
 setMimeType ($mimeType)
 Overwrite the current mime type of the file. More...
 
 additionalMetaData ()
 Provides a string map implementation which allows the processors to store additional values. More...
 

Private Attributes

 $filename
 
 $uploadSize
 
 $mimeType
 
 $additionalMetaData
 

Detailed Description

Class Metadata.

The meta data class holds all the data which are passed to each processor. This class only purpose is to transport data.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Since
5.3
Version
1.0

Definition at line 21 of file Metadata.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\FileUpload\DTO\Metadata::__construct (   $filename,
  $size,
  $mimeType 
)

Metadata constructor.

Parameters
string$filenameThe filename of the uploaded file.
int$sizeThe original size of the uploaded file.
string$mimeTypeThe mime type of the uploaded file.
Exceptions

Definition at line 53 of file Metadata.php.

References ILIAS\FileUpload\DTO\Metadata\$filename, ILIAS\FileUpload\DTO\Metadata\$mimeType, $size, and ILIAS\FileUpload\DTO\Metadata\additionalMetaData().

54  {
55  $this->stringTypeCheck($filename, "filename");
56  $this->intTypeCheck($size, "size");
57  $this->stringTypeCheck($mimeType, "mimeType");
58 
59  $this->filename = $filename;
60  $this->uploadSize = $size;
61  $this->mimeType = $mimeType;
62  $this->additionalMetaData = new EntryLockingStringMap();
63  }
$size
Definition: RandomTest.php:84
additionalMetaData()
Provides a string map implementation which allows the processors to store additional values...
Definition: Metadata.php:149
+ Here is the call graph for this function:

Member Function Documentation

◆ additionalMetaData()

ILIAS\FileUpload\DTO\Metadata::additionalMetaData ( )

Provides a string map implementation which allows the processors to store additional values.

The string map implementation used by the meta data refuses to overwrite values.

Returns
StringMap
Since
5.3

Definition at line 149 of file Metadata.php.

References ILIAS\FileUpload\DTO\Metadata\$additionalMetaData.

Referenced by ILIAS\FileUpload\DTO\Metadata\__construct(), and ilCountPDFPagesPreProcessors\process().

150  {
152  }
+ Here is the caller graph for this function:

◆ getFilename()

ILIAS\FileUpload\DTO\Metadata::getFilename ( )

The filename supplied by the browser.

Please be aware of the fact that this value can be potentially unsafe.

Returns
string
Since
5.3

Definition at line 73 of file Metadata.php.

References ILIAS\FileUpload\DTO\Metadata\$filename.

Referenced by ILIAS\FileUpload\Processor\FilenameSanitizerPreProcessor\process(), ILIAS\FileUpload\Processor\WhitelistExtensionPreProcessor\process(), ILIAS\FileUpload\Processor\BlacklistExtensionPreProcessor\process(), and ILIAS\FileUpload\FileUploadImpl\rejectFailedUpload().

74  {
75  return $this->filename;
76  }
+ Here is the caller graph for this function:

◆ getMimeType()

ILIAS\FileUpload\DTO\Metadata::getMimeType ( )

Client supplied mime type of the uploaded.

This value must be threaded as unreliable.

Returns
string
Since
5.3

Definition at line 118 of file Metadata.php.

References ILIAS\FileUpload\DTO\Metadata\$mimeType.

Referenced by ilCountPDFPagesPreProcessors\process(), ILIAS\FileUpload\Processor\BlacklistMimeTypePreProcessor\process(), ILIAS\FileUpload\Processor\WhitelistMimeTypePreProcessor\process(), and ILIAS\FileUpload\FileUploadImpl\rejectFailedUpload().

119  {
120  return $this->mimeType;
121  }
+ Here is the caller graph for this function:

◆ getUploadSize()

ILIAS\FileUpload\DTO\Metadata::getUploadSize ( )

This is always the original file size which was determined by the http service.

The current size is provided by the size method of the Stream passed to the processor. Please use the filesystem service to get the file size outside of the processors.

Returns
int
Since
5.3

Definition at line 105 of file Metadata.php.

References ILIAS\FileUpload\DTO\Metadata\$uploadSize.

Referenced by ILIAS\FileUpload\FileUploadImpl\rejectFailedUpload().

106  {
107  return $this->uploadSize;
108  }
+ Here is the caller graph for this function:

◆ setFilename()

ILIAS\FileUpload\DTO\Metadata::setFilename (   $filename)

Overwrite the current filename.

Parameters
string$filenameThe new filename.
Returns
Metadata
Since
5.3

Definition at line 87 of file Metadata.php.

References ILIAS\FileUpload\DTO\Metadata\$filename.

Referenced by ILIAS\FileUpload\Processor\FilenameSanitizerPreProcessor\process().

88  {
89  $this->stringTypeCheck($filename, "filename");
90 
91  $this->filename = $filename;
92 
93  return $this;
94  }
+ Here is the caller graph for this function:

◆ setMimeType()

ILIAS\FileUpload\DTO\Metadata::setMimeType (   $mimeType)

Overwrite the current mime type of the file.

Parameters
string$mimeTypeThe new mime type if the file.
Returns
Metadata
Since
5.3

Definition at line 132 of file Metadata.php.

References ILIAS\FileUpload\DTO\Metadata\$mimeType.

133  {
134  $this->stringTypeCheck($mimeType, "mimeType");
135 
136  $this->mimeType = $mimeType;
137 
138  return $this;
139  }

Field Documentation

◆ $additionalMetaData

StringMap ILIAS\FileUpload\DTO\Metadata::$additionalMetaData
private

Definition at line 39 of file Metadata.php.

Referenced by ILIAS\FileUpload\DTO\Metadata\additionalMetaData().

◆ $filename

string ILIAS\FileUpload\DTO\Metadata::$filename
private

◆ $mimeType

string ILIAS\FileUpload\DTO\Metadata::$mimeType
private

◆ $uploadSize

int ILIAS\FileUpload\DTO\Metadata::$uploadSize
private

Definition at line 31 of file Metadata.php.

Referenced by ILIAS\FileUpload\DTO\Metadata\getUploadSize().


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