phasync
UploadedFile / moveTo

Method

UploadedFile::moveTo

Moves the file to $targetPath, once.

Description#

public UploadedFile::moveTo(
    $targetPath
): void

A file path is moved with move_uploaded_file(), or with rename() in the CLI or with $isUploadedFile. A stream is copied to $targetPath. Either way an existing file at $targetPath is replaced.

Parameters#

$targetPath

Errors / Exceptions#

ExceptionWhen
RuntimeExceptionFor a second call, an upload that failed (getError()), or a target that cannot be written