Class UploadedFileFactory
Factory class for creating uploaded file instances.
Namespace: Cake\Http
Method Summary
-
createUploadedFile() public
Create a new uploaded file.
Method Detail
createUploadedFile() ΒΆ public
createUploadedFile(StreamInterface $stream, int|null $size = null, int $error = UPLOAD_ERR_OK, string|null $clientFilename = null, string|null $clientMediaType = null): UploadedFileInterface
Create a new uploaded file.
If a size is not provided it will be determined by checking the size of the stream.
Parameters
-
StreamInterface
$stream The underlying stream representing the uploaded file content.
-
int|null
$size optional The size of the file in bytes.
-
int
$error optional The PHP file upload error.
-
string|null
$clientFilename optional The filename as provided by the client, if any.
-
string|null
$clientMediaType optional The media type as provided by the client, if any.
Returns
UploadedFileInterface
Throws
InvalidArgumentException
If the file resource is not readable.
Links
http://php.net/manual/features.file-upload.post-method.php
http://php.net/manual/features.file-upload.errors.php
http://php.net/manual/features.file-upload.errors.php