Symfony\Component\HttpFoundation\File\UploadedFile::__construct
Accepts the information of the uploaded file as provided by the PHP global $_FILES.
The file object is only created when the uploaded file is valid (i.e. when the isValid() method returns true). Otherwise the only methods that could be called on an UploadedFile instance are: * getClientOriginalName, * getClientMimeType, * isValid, * getError. Calling any other method on an non-valid instance will cause an unpredictable result.
Signature
public function __construct(string
$path,
[string
$originalName = null,
[string
$mimeType = null,
[integer
$size = null,
[integer
$error = null,
[Boolean
$test = false]]]]] )
Parameters
$path
— string- The full temporary path to the file
$originalName
— string- The original file name
$mimeType
— string- The type of the file as provided by PHP
$size
— integer- The file size
$error
— integer- The error constant of the upload (one of PHP's UPLOAD_ERR_XXX constants)
$test
— object- Whether the test mode is active
Errors/Exceptions
-
FileException
- If file_uploads is disabled
-
FileNotFoundException
- If the file does not exist