Upload Fail

What's wrong with it:

action:

$uploaded_files = elgg_get_uploaded_files('upload');
if (!$uploaded_files) {
    register_error("No file was uploaded");
    forward(REFERER);
}

$uploaded_file = array_shift($uploaded_files);

$file = new ElggFile();
$file->owner_guid = 7777;
if ($file->acceptUploadedFile($uploaded_file)) {
    $file->save();
}

form:

echo elgg_view('input/file', [
    'name' => 'upload',
]);

Nothing unusual. But I get an error ("No file was uploaded") always.