I figured this out. I will add the solution in case others run into the same problem. First of all the forms enctype must be changed to multipart/form-data
Second of all yii\web\UploadedFile::getInstance() is a static method not a public method, and it has to be called like that. The documentation is a bit misleading.