/** * 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 IComponent * @return void */ protected function attached($form) { if ($form instanceof Form) { if ($form->getMethod() !== Form::POST) { throw new InvalidStateException('File upload requires method POST.'); } $form->getElementPrototype()->enctype = 'multipart/form-data'; } parent::attached($form); }