HttpUploadedFile
in package
implements
ICloseable
Represents an uploaded file in a multipart/form-data request.
Table of Contents
Interfaces
- ICloseable
- Provides an interface for releasing unmanaged resources.
Methods
- __construct() : mixed
- __destruct() : mixed
- close() : void
- Free, release or reset unmanaged resources.
- createFromFILE() : HttpUploadedFile
- Creates a HttpUploadedFile instance from an entry in the $_FILES superglobal.
- createFromFILES() : array<string, HttpUploadedFile|array<string, mixed>>
- Creates a collection of HttpUploadedFile instances from the $_FILES superglobal.
- getErrorCode() : int
- Retrieves the PHP file upload error code.
- getLocalFileName() : string|null
- Retrieves the local path to the uploaded file.
- getLocalMediaType() : MediaType|null
- Retrieves media type of the uploaded file.
- getSize() : int
- Retrieves the size of the uploaded file.
- getStream() : Stream
- Gets a read-only stream to the uploaded file.
- getSuggestedFileName() : string
- Retrieves the suggested name for the uploaded file.
- getSuggestedMediaType() : MediaType
- Retrieves the suggested media type for the uploaded file.
- hasMoved() : bool
- Checks whether the file has been moved to its final destination.
- moveTo() : void
- Moves the uploaded file to its final destination.
Methods
__construct()
public
__construct(int $errorCode, int $size, string $localFileName, string $suggestedFileName, MediaType|string $suggestedMediaType) : mixed
Parameters
- $errorCode : int
-
PHP file upload error code.
- $size : int
-
Size, as provided by the client.
- $localFileName : string
-
Filename generated by PHP on the server.
- $suggestedFileName : string
-
Filename included by the client.
- $suggestedMediaType : MediaType|string
-
Mediatype included by the client.
__destruct()
public
__destruct() : mixed
close()
Free, release or reset unmanaged resources.
public
close() : void
createFromFILE()
Creates a HttpUploadedFile instance from an entry in the $_FILES superglobal.
public
static createFromFILE(array<string, int|string> $file) : HttpUploadedFile
Parameters
- $file : array<string, int|string>
-
File info array.
Return values
HttpUploadedFile —Uploaded file info.
createFromFILES()
Creates a collection of HttpUploadedFile instances from the $_FILES superglobal.
public
static createFromFILES(array<string, mixed> $files) : array<string, HttpUploadedFile|array<string, mixed>>
Parameters
- $files : array<string, mixed>
-
Value of a $_FILES superglobal.
Return values
array<string, HttpUploadedFile|array<string, mixed>> —Uploaded files.
getErrorCode()
Retrieves the PHP file upload error code.
public
getErrorCode() : int
Return values
int —PHP file upload error code.
getLocalFileName()
Retrieves the local path to the uploaded file.
public
getLocalFileName() : string|null
Return values
string|null —Path to file, or null.
getLocalMediaType()
Retrieves media type of the uploaded file.
public
getLocalMediaType() : MediaType|null
Return values
MediaType|null —Type of file, or null.
getSize()
Retrieves the size of the uploaded file.
public
getSize() : int
Return values
int —Size of uploaded file.
getStream()
Gets a read-only stream to the uploaded file.
public
getStream() : Stream
Tags
Return values
Stream —Read-only stream of the upload file.
getSuggestedFileName()
Retrieves the suggested name for the uploaded file.
public
getSuggestedFileName() : string
Return values
string —Suggested name for the file.
getSuggestedMediaType()
Retrieves the suggested media type for the uploaded file.
public
getSuggestedMediaType() : MediaType
Return values
MediaType —Suggested type for the file.
hasMoved()
Checks whether the file has been moved to its final destination.
public
hasMoved() : bool
Return values
bool —true if it has been moved.
moveTo()
Moves the uploaded file to its final destination.
public
moveTo(string $path) : void
Parameters
- $path : string
-
Path to move the file to.