/**
* This method will be called when the component (or component's parent)
* becomes attached to a monitored object. Do not call this method yourself.
* @param Nette\Forms\IComponent
* @return void
*/
protected function attached($form)
{
if ($form instanceof Nette\Forms\Form) {
if ($form->getMethod() !== Nette\Forms\Form::POST) {
throw new Nette\InvalidStateException('File upload requires method POST.');
}
$form->getElementPrototype()->enctype = 'multipart/form-data';
}
parent::attached($form);
}