◆ __construct()
__construct |
( |
|
$streamOrFile, |
|
|
int |
$size, |
|
|
int |
$errorStatus, |
|
|
string |
$clientFilename = null , |
|
|
string |
$clientMediaType = null |
|
) |
| |
◆ getClientFilename()
{Retrieve the filename sent by the client.Do not trust the value returned by this method. A client could send a malicious filename with the intention to corrupt or hack your application.Implementations SHOULD return the value stored in the "name" key of the file in the $_FILES array.
- Renvoie
- string|null The filename sent by the client or null if none was provided.
}
- Renvoie
- string|null The filename sent by the client or null if none was provided.
Implémente UploadedFileInterface.
Références UploadedFile\$clientFilename.
◆ getClientMediaType()
{Retrieve the media type sent by the client.Do not trust the value returned by this method. A client could send a malicious media type with the intention to corrupt or hack your application.Implementations SHOULD return the value stored in the "type" key of the file in the $_FILES array.
- Renvoie
- string|null The media type sent by the client or null if none was provided.
}
Implémente UploadedFileInterface.
Références UploadedFile\$clientMediaType.
◆ getError()
◆ getSize()
{Retrieve the file size.Implementations SHOULD return the value stored in the "size" key of the file in the $_FILES array if available, as PHP calculates this based on the actual size transmitted.
- Renvoie
- int|null The file size in bytes or null if unknown.
}
- Renvoie
- int|null The file size in bytes or null if unknown.
Implémente UploadedFileInterface.
Références UploadedFile\$size.
◆ getStream()
◆ moveTo()
{Move the uploaded file to a new location.Use this method as an alternative to move_uploaded_file(). This method is guaranteed to work in both SAPI and non-SAPI environments. Implementations must determine which environment they are in, and use the appropriate method (move_uploaded_file(), rename(), or a stream operation) to perform the operation.$targetPath may be an absolute path, or a relative path. If it is a relative path, resolution should be the same as used by PHP's rename() function.The original file or stream MUST be removed on completion.If this method is called more than once, any subsequent calls MUST raise an exception.When used in an SAPI environment where $_FILES is populated, when writing files via moveTo(), is_uploaded_file() and move_uploaded_file() SHOULD be used to ensure permissions and upload status are verified correctly.If you wish to move to a stream, use getStream(), as SAPI operations cannot guarantee writing to stream destinations.
- Voir également
- http://php.net/is_uploaded_file
-
http://php.net/move_uploaded_file
- Paramètres
-
string | $targetPath | Path to which to move the uploaded file. |
- Exceptions
-
}
- Voir également
- http://php.net/is_uploaded_file
-
http://php.net/move_uploaded_file
- Paramètres
-
string | $targetPath | Path to which to move the uploaded file. |
- Exceptions
-
Implémente UploadedFileInterface.
Références UploadedFileErrorException\dueToStreamUploadError(), UploadedFileErrorException\dueToUnwritableTarget(), UploadedFileErrorException\forUnmovableFile(), et UploadedFile\writeFile().
◆ writeFile()
writeFile |
( |
string |
$path | ) |
|
|
private |
◆ $clientFilename
◆ $clientMediaType
◆ $error
◆ $file
◆ $moved
◆ $size
◆ $stream
◆ ERROR_MESSAGES
Valeur initiale := [
UPLOAD_ERR_OK =>
'There is no error, the file uploaded with success'
◆ UPLOAD_ERR_INI_SIZE
const UPLOAD_ERR_INI_SIZE |
Valeur initiale :=> 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
. 'specified in the HTML form',
]
La documentation de cette classe a été générée à partir du fichier suivant :