protected function createComponentUploadForm($name) { $form = new \Nette\Application\AppForm($this, $name); $form->addFile("file"); $handler = $this->handler; $redirectUri = $this->redirectUri; $control = $this; $form->addSubmit("s")->onClick[] = function ($btn) use($control, $handler, $redirectUri) { $handler($btn->form["file"]->value); if ($redirectUri) { $control->presenter->redirectUri($redirectUri); } }; }