public function handleUpload(Form $form, $values) { try { if (is_array($values['upload'])) { /** @var FileUpload $fileUpload */ foreach ($values['upload'] as $fileUpload) { $file = \vojtabiberle\MediaStorage\Bridges\Nette\Http\FileUpload::createFromNetteFileUpload($fileUpload); $this->manager->save($file); $this->presenter->flashMessage('File "' . $file->getName() . '" was uploaded'); } } else { throw new NoFileUploadedException('No files was uploaded'); } } catch (RuntimeException $e) { $this->presenter->flashMessage($e->getMessage(), 'error'); } }