src/web/UploadedFile.php
public function saveAsTempFile(bool $deleteTempFile = true)
    {
        if ($this->error != UPLOAD_ERR_OK) {
            return false;
        }
        $tempPath = FileHelper::getTempFilePath($this->name);
        if (!$this->saveAs($tempPath, $deleteTempFile)) {
            return false;
        }
        return $tempPath;
    }
public function saveAsTempFile(bool $deleteTempFile = true)
    {
        if ($this->error != UPLOAD_ERR_OK) {
            return false;
        }
        $tempPath = FileHelper::getTempFilePath($this->name);
        if (!$this->saveAs($tempPath, $deleteTempFile)) {
            return false;
        }
        return $tempPath;
    }
public function saveAsTempFile ( bool $ deleteTempFile = true ) { if ( $ this -> error != UPLOAD_ERR_OK ) { return false ; } $ tempPath = FileHelper :: getTempFilePath ( $ this -> name ) ; if ( ! $ this -> saveAs ( $ tempPath , $ deleteTempFile ) ) { return false ; } return $ tempPath ; }
Saves the uploaded file to a temp location.

@param bool $deleteTempFile whether to delete the temporary file after saving.
If true, you will not be able to save the uploaded file again in the current request.
@return string|false the path to the temp file, or false if the file wasn't saved successfully
@see error
@throws \yii\base\Exception
Saves the uploaded file to a temp location .