Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

UploadedFileInterface.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 4.61 KiB


001  <?php
002   
003  declare(strict_types=1);
004   
005  namespace Psr\Http\Message;
006   
007  /**
008   * Value object representing a file uploaded through an HTTP request.
009   *
010   * Instances of this interface are considered immutable; all methods that
011   * might change state MUST be implemented such that they retain the internal
012   * state of the current instance and return an instance that contains the
013   * changed state.
014   */
015  interface UploadedFileInterface
016  {
017      /**
018       * Retrieve a stream representing the uploaded file.
019       *
020       * This method MUST return a StreamInterface instance, representing the
021       * uploaded file. The purpose of this method is to allow utilizing native PHP
022       * stream functionality to manipulate the file upload, such as
023       * stream_copy_to_stream() (though the result will need to be decorated in a
024       * native PHP stream wrapper to work with such functions).
025       *
026       * If the moveTo() method has been called previously, this method MUST raise
027       * an exception.
028       *
029       * @return StreamInterface Stream representation of the uploaded file.
030       * @throws \RuntimeException in cases when no stream is available or can be
031       *     created.
032       */
033      public function getStream();
034   
035      /**
036       * Move the uploaded file to a new location.
037       *
038       * Use this method as an alternative to move_uploaded_file(). This method is
039       * guaranteed to work in both SAPI and non-SAPI environments.
040       * Implementations must determine which environment they are in, and use the
041       * appropriate method (move_uploaded_file(), rename(), or a stream
042       * operation) to perform the operation.
043       *
044       * $targetPath may be an absolute path, or a relative path. If it is a
045       * relative path, resolution should be the same as used by PHP's rename()
046       * function.
047       *
048       * The original file or stream MUST be removed on completion.
049       *
050       * If this method is called more than once, any subsequent calls MUST raise
051       * an exception.
052       *
053       * When used in an SAPI environment where $_FILES is populated, when writing
054       * files via moveTo(), is_uploaded_file() and move_uploaded_file() SHOULD be
055       * used to ensure permissions and upload status are verified correctly.
056       *
057       * If you wish to move to a stream, use getStream(), as SAPI operations
058       * cannot guarantee writing to stream destinations.
059       *
060       * @see http://php.net/is_uploaded_file
061       * @see http://php.net/move_uploaded_file
062       * @param string $targetPath Path to which to move the uploaded file.
063       * @throws \InvalidArgumentException if the $targetPath specified is invalid.
064       * @throws \RuntimeException on any error during the move operation, or on
065       *     the second or subsequent call to the method.
066       */
067      public function moveTo(string $targetPath);
068      
069      /**
070       * Retrieve the file size.
071       *
072       * Implementations SHOULD return the value stored in the "size" key of
073       * the file in the $_FILES array if available, as PHP calculates this based
074       * on the actual size transmitted.
075       *
076       * @return int|null The file size in bytes or null if unknown.
077       */
078      public function getSize();
079      
080      /**
081       * Retrieve the error associated with the uploaded file.
082       *
083       * The return value MUST be one of PHP's UPLOAD_ERR_XXX constants.
084       *
085       * If the file was uploaded successfully, this method MUST return
086       * UPLOAD_ERR_OK.
087       *
088       * Implementations SHOULD return the value stored in the "error" key of
089       * the file in the $_FILES array.
090       *
091       * @see http://php.net/manual/en/features.file-upload.errors.php
092       * @return int One of PHP's UPLOAD_ERR_XXX constants.
093       */
094      public function getError();
095      
096      /**
097       * Retrieve the filename sent by the client.
098       *
099       * Do not trust the value returned by this method. A client could send
100       * a malicious filename with the intention to corrupt or hack your
101       * application.
102       *
103       * Implementations SHOULD return the value stored in the "name" key of
104       * the file in the $_FILES array.
105       *
106       * @return string|null The filename sent by the client or null if none
107       *     was provided.
108       */
109      public function getClientFilename();
110      
111      /**
112       * Retrieve the media type sent by the client.
113       *
114       * Do not trust the value returned by this method. A client could send
115       * a malicious media type with the intention to corrupt or hack your
116       * application.
117       *
118       * Implementations SHOULD return the value stored in the "type" key of
119       * the file in the $_FILES array.
120       *
121       * @return string|null The media type sent by the client or null if none
122       *     was provided.
123       */
124      public function getClientMediaType();
125  }
126